home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cxl41.arc / CXL.DOC next >
Text File  |  1989-03-05  |  168KB  |  5,074 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.                                     C X L
  25.  
  26.                  The C Programmer's Extended Function Library
  27.  
  28.                                  Version 4.1
  29.  
  30.                               September 4, 1988
  31.  
  32.                                by Mike Smedley
  33.  
  34.                 Copyright (c) 1987, 1988  All Rights Reserved
  35.  
  36.                                Reference Manual
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.                               Table of Contents
  70.  
  71.                  Introduction................................1
  72.                       Features of the CXL Library............1
  73.                       Registration Information...............2
  74.                       How to Contact the Author..............3
  75.                       Disclaimer.............................3
  76.                       Trademarks.............................3
  77.                  Tutorial....................................4
  78.                       Using CXL Functions....................4
  79.                       Windowing Functions ...................5
  80.                       Formatted Keyboard Input Functions.....6
  81.                       Multi-Field Formatted Input Functions..9
  82.                       Bar-Selection Menu Functions..........12
  83.                       String Selection Functions............16
  84.                       Expanded Memory ......................17
  85.                       Mouse Functions.......................19
  86.                  Global Variables...........................20
  87.                       _dvcheck..............................20
  88.                       _kbloop...............................20
  89.                       _mouse................................20
  90.                       _onkey................................20
  91.                       _vbios................................20
  92.                       _videoseg.............................20
  93.                       _werrno...............................20
  94.                       _wesc.................................20
  95.                       _whandle..............................21
  96.                       _whrec................................21
  97.                       _winp.................................21
  98.                       _wmenu................................21
  99.                       _wrec.................................21
  100.                       _wsel.................................21
  101.                       _wtotal...............................21
  102.                  Library Functions..........................22
  103.                       attrib................................22
  104.                       beep..................................22
  105.                       biosver...............................22
  106.                       box_..................................22
  107.                       capsoff...............................23
  108.                       capson................................23
  109.                       clearkeys.............................23
  110.                       clockcal..............................23
  111.                       clreol_...............................23
  112.                       clrscrn...............................24
  113.                       clrwin................................24
  114.                       cvaltype..............................24
  115.                       delay_................................24
  116.                       disktoscrn............................25
  117.                       disktowin.............................25
  118.                       emsalloc..............................25
  119.                       emsdealloc............................26
  120.                       emsexist..............................26
  121.                       emsframe..............................26
  122.                       emsfree...............................26
  123.  
  124.  
  125.  
  126.                                       i
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.                       emsmap................................27
  136.                       emsread...............................27
  137.                       emstotal..............................27
  138.                       emsver................................27
  139.                       emswrite..............................28
  140.                       expmem................................28
  141.                       extmem................................28
  142.                       fill_.................................28
  143.                       gameport..............................29
  144.                       getchf................................29
  145.                       getns.................................29
  146.                       getxch................................30
  147.                       gotoxy_...............................30
  148.                       inputsf...............................30
  149.                       kbstat................................31
  150.                       lcrlf.................................31
  151.                       lprintc...............................31
  152.                       lprintf...............................31
  153.                       lprintns..............................32
  154.                       lprints...............................32
  155.                       lprintsb..............................32
  156.                       lprintsu..............................32
  157.                       machid................................33
  158.                       mathchip..............................33
  159.                       mode..................................33
  160.                       msbpress..............................33
  161.                       msbreles..............................34
  162.                       mscursor..............................34
  163.                       msgotoxy..............................34
  164.                       mshbounds.............................35
  165.                       mshidecur.............................35
  166.                       msinit................................35
  167.                       msmotion..............................35
  168.                       msshowcur.............................36
  169.                       msspeed...............................36
  170.                       msstatus..............................36
  171.                       msvbounds.............................36
  172.                       numflop...............................37
  173.                       numoff................................37
  174.                       numon.................................37
  175.                       numpar................................37
  176.                       numser................................37
  177.                       printc................................38
  178.                       prints................................38
  179.                       putchat...............................38
  180.                       readchat..............................38
  181.                       readcur...............................39
  182.                       revattr...............................39
  183.                       scrndump..............................39
  184.                       scrntodisk............................39
  185.                       setattr...............................40
  186.                       setcursz..............................40
  187.                       setkbloop.............................40
  188.                       setlines..............................40
  189.  
  190.  
  191.  
  192.                                       ii
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.                       setonkey..............................41
  202.                       sound_................................41
  203.                       spc...................................42
  204.                       srestore..............................42
  205.                       ssave.................................42
  206.                       strblank..............................42
  207.                       strbmatch.............................43
  208.                       strchg................................43
  209.                       strcode...............................43
  210.                       strdel................................44
  211.                       strichg...............................44
  212.                       stridel...............................44
  213.                       striinc...............................44
  214.                       strinc................................45
  215.                       strins................................45
  216.                       striocc...............................45
  217.                       strleft...............................46
  218.                       strltrim..............................46
  219.                       strmatch..............................46
  220.                       strmid................................47
  221.                       strocc................................47
  222.                       strright..............................47
  223.                       strrol................................48
  224.                       strror................................48
  225.                       strsetsz..............................48
  226.                       strshl................................48
  227.                       strshr................................49
  228.                       strtrim...............................49
  229.                       struplow..............................49
  230.                       sysdate...............................50
  231.                       systime...............................50
  232.                       tabstop...............................50
  233.                       timer.................................50
  234.                       touplow...............................51
  235.                       videoinit.............................51
  236.                       vidtype...............................51
  237.                       wactiv................................52
  238.                       waitkey...............................52
  239.                       waitkeyt..............................52
  240.                       wblocked..............................52
  241.                       wborder...............................53
  242.                       wbox..................................53
  243.                       wcclear...............................54
  244.                       wcenters..............................54
  245.                       wchgattr..............................54
  246.                       wclear................................54
  247.                       wclose................................55
  248.                       wcloseall.............................55
  249.                       wclreol...............................55
  250.                       wclreos...............................55
  251.                       wcopy.................................55
  252.                       wdelline..............................56
  253.                       wdupc.................................56
  254.                       werrmsg...............................56
  255.  
  256.  
  257.  
  258.                                      iii
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.                       wfill.................................57
  268.                       wfindrec..............................57
  269.                       wgetc.................................57
  270.                       wgetchf...............................58
  271.                       wgetns................................58
  272.                       wgets.................................58
  273.                       wgotoxy...............................59
  274.                       whandle...............................59
  275.                       whide.................................59
  276.                       whline................................60
  277.                       winpdef...............................60
  278.                       winpread..............................61
  279.                       winputsf..............................61
  280.                       winsline..............................61
  281.                       wintodisk.............................62
  282.                       wisactiv..............................62
  283.                       wmenudef..............................62
  284.                       wmenuget..............................63
  285.                       wmessage..............................64
  286.                       wmove.................................64
  287.                       wopen.................................64
  288.                       wperror...............................65
  289.                       wpgotoxy..............................65
  290.                       wprintc...............................66
  291.                       wprintf...............................66
  292.                       wprints...............................66
  293.                       wputc.................................67
  294.                       wputns................................67
  295.                       wputs.................................67
  296.                       wrestore..............................67
  297.                       wrjusts...............................68
  298.                       wsave.................................68
  299.                       wsbounds..............................68
  300.                       wscanf................................69
  301.                       wscroll...............................69
  302.                       wsetesc...............................69
  303.                       wsize.................................69
  304.                       wsseldef..............................70
  305.                       wsselget..............................70
  306.                       wtextattr.............................70
  307.                       wtitle................................71
  308.                       wunhide...............................71
  309.                       wvline................................71
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.                                       iv
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.                                 Introduction
  336.  
  337.     The CXL library is intended to be a supplement to your compiler's
  338.     run-time library.  It contains over 170 multi-purpose functions.  The
  339.     heart of CXL is the windowing system.  There are many supporting
  340.     features as well.  The library is available for several of today's
  341.     popular C compilers.  These routines were written in highly-optimized C
  342.     code ensuring maximum program speed and minimum program size.  This
  343.     release is an evaluation release containing everything you need to write
  344.     C programs using the small memory model.  The libraries for the other
  345.     memory models are supplied when you register.
  346.  
  347.  
  348.     Features of the CXL Library.
  349.  
  350.         -   Flexible, easy-to-use, windowing system
  351.         -   Pop-up menus
  352.         -   Pull-down menus
  353.         -   Lotus-style menus
  354.         -   Multi-field keyboard data entry
  355.         -   Formatted keyboard input
  356.         -   EGA 43-line and VGA 50-line modes
  357.         -   Direct screen writing for speed
  358.         -   BIOS screen writing for compatibility
  359.         -   DESQview compatibility
  360.         -   Microsoft compatible mouse functions
  361.         -   Lotus/Intel/Microsoft EMS memory functions
  362.         -   Screen/window swapping to memory or disk
  363.         -   Advanced string manipulation
  364.         -   Keyboard event trapping
  365.         -   Simple context sensitive help
  366.         -   Pattern matching
  367.         -   Data encryption
  368.         -   Date and time functions
  369.         -   Equipment detection
  370.         -   Printing functions
  371.         -   Sound functions
  372.         -   and more!
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.     Registration Information.
  400.  
  401.     You are free to copy and distribute this library freely, however, if you
  402.     find this library of use to you, you are encouraged to register your
  403.     copy.  The prices are as follows:
  404.  
  405.     Basic Registration:                                         $25.00
  406.         Includes:
  407.             - the complete library source code!
  408.             - one library disk containing libraries for
  409.               all memory models supported by your compiler.
  410.             - royalty-free use of library functions.
  411.             - technical support.
  412.             - low-cost upgrades to future revisions.
  413.             - shipping and handling.
  414.  
  415.     Additional Library Disks:                                   $5.00 ea.
  416.         The following library disks are available:
  417.             - Microsoft C/QuickC
  418.             - Power C
  419.             - Turbo C
  420.             - Zortech C++
  421.  
  422.     Upgrades from Prior Versions of CXL:                        $5.00 ea.
  423.         For registered users of CXL.  Add for each library
  424.         disk you are upgrading.
  425.  
  426.     Non-U.S. Orders:                                            $5.00
  427.         Non U.S. registrations, add to cover additional
  428.         shipping expenses.
  429.  
  430.     All materials are shipped on 5.25-inch floppy diskettes.  To register,
  431.     print the registration form, REGISTER.DOC, by typing the DOS command
  432.     "copy register.doc prn", or you can use any piece of paper and include
  433.     on it the same information as requested in the REGISTER.DOC file.  Send
  434.     payment to:
  435.  
  436.             Mike Smedley
  437.             P.O. Box 33603
  438.             San Antonio, TX 78265-3603
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.                                       2
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.     How to Contact the Author.
  466.  
  467.     U.S. Mail       -   see address above
  468.     Telephone       -   (512) 590-2910  (after 5 PM & weekends, not collect)
  469.     CompuServe      -   71331,2244
  470.     GEnie           -   M.SMEDLEY
  471.     Abbey Road BBS  -   (512) 590-6036  1200/2400/9600 8-N-1
  472.     Telstar BBS     -   (512) 822-8882  1200/2400 8-N-1
  473.  
  474.  
  475.     Disclaimer.
  476.  
  477.     The author claims no responsibility for any damages caused by the use or
  478.     misuse of this library.  This product is distributed "as is" with no
  479.     warranty expressed or implied.  The author will not be responsible for
  480.     any losses incurred by the use of this product.  The author reserves the
  481.     right to make modifications at any time.  Prices are subject to change
  482.     without notice.
  483.  
  484.  
  485.     Trademarks.
  486.  
  487.     CompuServe is a registered trademark of CompuServe Incorporated.
  488.     DESQview is a trademark of Quarterdeck Office Systems.
  489.     Epson is a registered trademark of Seiko Epson Corporation.
  490.     GEnie is a trademark of GE Information Services.
  491.     IBM is a registered trademark of International Business Machines.
  492.     LIM and EMS are trademarks of Lotus, Intel, and Microsoft Corps.
  493.     Lotus is a registered trademark of Lotus Development Corporation.
  494.     Microsoft is a registered trademark of Microsoft Corporation.
  495.     Power C is a trademark of Mix Software, Inc.
  496.     Turbo C is a registered trademark of Borland International.
  497.     Zortech is a trademark of Zortech Limited.
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.                                       3
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.                                    Tutorial
  532.  
  533.     Using CXL Functions.
  534.  
  535.     For every CXL function you use, there should be its corresponding CXL
  536.     header file #included at the top of your program.  The CXL header files
  537.     should follow your standard compiler header files.  For example:
  538.  
  539.         #include    <dos.h>
  540.         #include    <stdio.h>
  541.         #include    "cxldef.h"
  542.         #include    "cxlwin.h"
  543.  
  544.     The basic command line compiler/linker commands to build your file
  545.     containing CXL functions are as follows:
  546.  
  547.         Microsoft C:
  548.  
  549.             cl myfile.c cxls.lib
  550.  
  551.         Quick C:
  552.  
  553.             qcl myfile.c cxls.lib
  554.  
  555.         Power C:
  556.  
  557.             pc -c -d__POWERC__ myfile.c
  558.             pcl myfile.mix ;cxlm.mix
  559.  
  560.         Turbo C:
  561.  
  562.             tcc myfile.c cxls.lib
  563.  
  564.         Zortech C++:
  565.  
  566.             ztc myfile.c cxls.lib           /* for C programs */
  567.  
  568.             ztc myfile.cpp cxls.lib         // for C++ programs
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.                                       4
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.     Windowing Functions (General).
  598.  
  599.     CXL has a powerful windowing system that can be very useful in an
  600.     application program.  All windowing functions are prefixed with a 'w'.
  601.     The windowing is controlled by CXL's window manager which is called by
  602.     every windowing function.  The window manager keeps track of which
  603.     window is active; each window's position, cursor position, attributes,
  604.     etc.; how many windows are open; and other information.
  605.  
  606.     All windowing functions set the _werrno global variable before
  607.     returning.  The literal value of this variable can be viewed by calling
  608.     the werrmsg() function. This feature is useful for debugging programs
  609.     that use the windowing functions.
  610.  
  611.     Windows can have a border or be borderless.  Borderless windows have a
  612.     greater effective region of which to work with.  Window borders can be a
  613.     variety of styles.
  614.  
  615.     Windows may also have titles.  If the window has a border, the title
  616.     will be displayed on the top border.  The window title can also be
  617.     used to name a window allowing an alternative for identification.
  618.  
  619.     You may open as many windows as memory permits.  Once a window is
  620.     opened, it immediately becomes the active window.  The majority of CXL's
  621.     windowing functions can only be performed on the active window.  If you
  622.     want to perform a function on a inactive window, you must activate it
  623.     first.
  624.  
  625.     Once you have a window opened, you may perform a variety of tasks in it
  626.     including displaying output, accepting input, resizing, changing colors,
  627.     moving, changing border style, and more.  See the supplied CXLDEMO.C
  628.     program for a complete example of how to use the windowing system.
  629.  
  630.     Example:
  631.  
  632.         WINDOW w1,w2;                   /*  window handles       */
  633.                                         /*  open 1st window      */
  634.         w1=wopen(0,0,10,40,0,LCYAN|_BLUE,LCYAN|_BLUE);
  635.         if(!w1) error_routine();        /*  check for error      */
  636.         wputs("Hello, ");               /*  display string       */
  637.                                         /*  open 2nd window      */
  638.         w2=wopen(7,20,18,60,2,LRED|_MAGENTA,LRED|_MAGENTA);
  639.         if(!w2) error_routine();        /*  check for error      */
  640.         wputs("Hello, ");               /*  display string       */
  641.         wactiv(w1);                     /*  activate 1st window  */
  642.         wputs("there");                 /*  display string       */
  643.         wactiv(w2);                     /*  activate 2nd window  */
  644.         wputs("there");                 /*  display string       */
  645.         wclose();                       /*  close 2nd window     */
  646.         wclose();                       /*  close 1st window     */
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.                                       5
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.    Formatted Keyboard Input Functions.
  664.  
  665.     The inputsf() and winputsf() functions in CXL accept keyboard input
  666.     through the use of CXL's own input format strings.  These format strings
  667.     are not the same as what scanf() uses.  They have the ability to
  668.     restrict and convert input for each character received from the
  669.     keyboard.  They also allow for custom prompts between each character
  670.     input.  The format control characters can be in any order in the string,
  671.     but all letters must be in the case shown here.  Invalid control
  672.     characters will cause the function to return an error and the receiving
  673.     string will be empty.  Spaces can be used to improve readability of the
  674.     format string.  If the Escape key is not disabled, when pressed it will
  675.     return an error code and the receiving string will be empty.  Valid
  676.     format control characters are:
  677.  
  678.         !.......!   - start and end exclamation points, any letters between
  679.                       them are format command toggles.  The valid format
  680.                       command toggles are:
  681.  
  682.                         -   - decreases text attribute, works with
  683.                               winputsf() only
  684.  
  685.                         +   - increases text attribute, works with
  686.                               winputsf() only
  687.  
  688.                         C   - toggles copying of display (quoted) characters
  689.                               to the receiving string. (default is off)
  690.  
  691.                         E   - toggles Escape key checking off/on. When off,
  692.                               if the Escape key is pressed, the function
  693.                               returns an error code and the string will be
  694.                               null.   The default for inputsf() is on.  For
  695.                               winputsf(), the default is the value of the
  696.                               global variable _wesc upon calling.
  697.  
  698.                         L   - toggles lower-case conversion.  When on, the
  699.                               case of input letters will be forced to lower
  700.                               case. (default is off)
  701.  
  702.                         M   - toggles mixed-case conversion.  When on, the
  703.                               case of input letters will be forced to
  704.                               upper-case for the first letter of each word
  705.                               and lower-case for the remaining letters.
  706.                               (default is off)
  707.  
  708.                         P   - toggles password mode.  When on, input
  709.                               characters will be echoed to the screen as
  710.                               spaces. (default is off)
  711.  
  712.                         R   - toggles return key checking.  When off, the
  713.                               carriage return key will be ignored until the
  714.                               end of the format string. (default is on)
  715.  
  716.                         U   - toggles upper-case conversion.  When on, the
  717.  
  718.  
  719.  
  720.                                       6
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.                               case of input letters will be forced to
  730.                               upper-case. (default is off)
  731.  
  732.  
  733.         '.......'   - start and end quotes, any characters between them will
  734.           .OR.        be displayed as text.  If the 'C' command toggle is
  735.         \".....\"     on, the characters will also be copied to the
  736.                       receiving string.
  737.  
  738.         #   - accept numeric character '0' thru '9'.
  739.         %   - accept numeric character '0' thru '9' and space.
  740.         9   - accept numeric character '0' thru '9', '.', '-', and '+'.
  741.         ?   - accept any character.
  742.         *   - accept any printable character.
  743.         A   - accept alpha character 'A' thru 'Z', 'a' thru 'z', and
  744.               space.
  745.         D   - accept character associated with a numeric date '0' thru
  746.               '9', '-', and '/'.
  747.         L   - accept alpha character 'A' thru 'Z', 'a' thru 'z', and
  748.               space.  Input characters will be converted to lower case.
  749.         M   - accept alpha character 'A' thru 'Z', 'a' thru 'z', and
  750.               space input character will be converted to mixed case.
  751.         P   - accept alphanumeric password character 'A' thru 'Z',
  752.               'a' thru 'z', '0' thru '9', and space.
  753.         T   - accept character associated with a telephone number
  754.               '0' thru '9', '(', ')', '-', and space.
  755.         U   - accept alpha character 'A' thru 'Z', 'a' thru 'z', and
  756.               space input character will be converted to upper case.
  757.         X   - accept alphanumeric character 'A' thru 'Z', 'a' thru 'z',
  758.               '0' thru '9', and space.
  759.         Y   - accept a yes/no character 'Y', 'y', 'N', and 'n'.
  760.  
  761.  
  762.     <.......>   - set inclusion.  Accept a character from valid list of
  763.                   characters between angle brackets.
  764.  
  765.     [.......]   - set exclusion.  Accept a character which cannot be
  766.                   present in between the square brackets.
  767.  
  768.     Examples:
  769.  
  770.     inputsf(str,"'Enter name:  ' !UR! XXXXX !R! XXXXXXXXXX");
  771.  
  772.     Prompts for name, inputs string from keyboard converting characters to
  773.     upper case as it goes, allows up to 15 alphanumeric characters as input.
  774.     The return key is disabled until at least 5 characters have been
  775.     entered.  Characters will be copied to str.  This space must already be
  776.     allocated!
  777.  
  778.  
  779.     inputsf(str,"!R! 'Enter phone:  '!C! '(' ### ') ' ### '-' ####");
  780.  
  781.     Prompts for a full phone number including area code, allows only digit
  782.     characters and displays format punctuation as it goes.  The entire field
  783.  
  784.  
  785.  
  786.                                       7
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.     must be filled before return can be pressed.  All of the characters
  796.     except the prompt will be copied to the receiving string.  The input
  797.     string will be copied to str, which must have already been allocated.
  798.  
  799.  
  800.     inputsf(str,"!R!'Enter SSAN:  '<0123456>##'-'##'-'####");
  801.  
  802.     Prompts for a Social Security number.  Will not allow return to be
  803.     pressed until all digits have been entered.  The first digit of the SSAN
  804.     must be 0 - 6. Dashes will be displayed as you are typing in the data,
  805.     but will not be contained in the receiving string str.
  806.  
  807.  
  808.     inputsf(str,"!R!'Enter DOB (MM/DD/YY):  '<01>#'/'<0123>#'/'##");
  809.  
  810.     Prompts for Date of Birth.  Allows only valid digits for the input date.
  811.     Prevents the return key from working until all digits have been typed
  812.     in.
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.                                       8
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.     Multi-Field Formatted Input Functions.
  862.  
  863.     Two functions are needed to process multi-field keyboard input from
  864.     windows:  winpdef(), and winpread().  The winpdef() function defines
  865.     your input field and is called for each input field to be defined. The
  866.     winpread() function processes all defined fields.  The formatted input
  867.     capabilities are much like those of the inputsf() and winputsf()
  868.     functions.  The major difference is that with the winpdef()/winpread()
  869.     combination, you can edit back and forth between fields before finally
  870.     accepting the input.
  871.  
  872.     For every input field you want to define, you must call winpdef(). This
  873.     will allocate memory to hold the input record information. The first two
  874.     parameters, wrow and wcol, specify where in the active window the field
  875.     will be loaded.  The next parameter, str, is the address of the string
  876.     buffer to receive the input data.
  877.  
  878.     The next parameter, format, is the input field format string. It
  879.     controls how each character is input and how large the input field will
  880.     be.  It consists of 1 or more format characters, and may have displayed
  881.     text in between any of the format control characters.  You may use
  882.     spaces in between the format control characters for readability.  Valid
  883.     format control characters are listed in the "Formatted Keyboard Input
  884.     Functions" section.  The case of the format control characters must be
  885.     as shown.  Format strings for winpdef() are just like those of inputsf()
  886.     and winputsf() except there are no command toggles. If you make a syntax
  887.     error in the format string, winpdef() will return W_INVFORMT to notify
  888.     you of the mistake.
  889.  
  890.     The next parameter in the winpdef() function is fconv.  These are
  891.     similar to the command toggles of inputsf() and winputsf() except that
  892.     the fconv character applies conversion to the whole field.  Valid fconv
  893.     characters are:
  894.  
  895.             0   - apply no conversion
  896.             'L' - convert letters to lower case
  897.             'M' - convert letters to mixed upper & lower case
  898.             'P' - password field (do not echo characters)
  899.             'U' - convert letters to upper case
  900.  
  901.     The next parameter in the winpdef() function is fattr.  This is the text
  902.     attribute of the screen field.  After the fattr parameter comes the
  903.     update parameter.  This parameter allows you to specify if the input
  904.     field is going to create new data or update old data.  If the update
  905.     parameter is 0, then the input field will be used for entering new data.
  906.     If the update parameter is non-zero, then the input field will be used
  907.     to update the old data contained in the str parameter.  If you do choose
  908.     to update, then the length of the str string must be the same as the
  909.     length of the input field defined in the format string.  If the two
  910.     lengths don't match, then winpdef() will return W_LENFORMT.
  911.  
  912.     The last parameter in the winpdef() function is validate.  This
  913.     parameter is the address of an optional user validation/modification
  914.     function.  If no validation function is to be used, then specify NULL.
  915.  
  916.  
  917.  
  918.                                       9
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.     Your user validation/modification function must be declared like:
  928.  
  929.                     int func(char *str);
  930.  
  931.     where str is the address of the input field that will be passed to it.
  932.     Once your user function has the address of the input field, you can
  933.     validate and/or modify the input field. Your function can also display
  934.     an error message, sound a bell, or just about anything. When your
  935.     function is done, it must return 0 for no error.
  936.  
  937.     Once you have defined all input fields with winpdef(), you call
  938.     winpread() to process them.  The user is allowed to move around and edit
  939.     all of the fields.  The input fields are validated on the fly and after
  940.     entering the last field.  Valid editing keys are:
  941.  
  942.             LeftArrow       - moves cursor left a position.
  943.             RightArrow      - moves cursor right a position.
  944.             UpArrow         - moves cursor to the previous field up.
  945.             DownArrow       - moves cursor to the next field down.
  946.             Ctrl-LeftArrow  - moves cursor to previous word left.
  947.             Ctrl-RightArrow - moves cursor to next word right.
  948.             Tab             - moves cursor to the next field right.
  949.             Shift-Tab       - moves cursor to the previous field left.
  950.             Enter           - if the cursor is in the last field on the
  951.                               screen, it will process all fields.  Otherwise
  952.                               it will skip to the next field.
  953.             Ctrl-Enter      - processes all fields, wherever cursor may be
  954.             Home            - moves cursor to first position of field.
  955.             End             - moves cursor to last position of field.
  956.             Ctrl-Home       - moves cursor to the first position of the
  957.                               first field on the screen.
  958.             Ctrl-End        - moves cursor to the last position of the last
  959.                               field on the screen.
  960.             Ins             - inserts a space at cursor position.  All text
  961.                               to the right of the cursor will be shifted
  962.                               right. The end character will be dropped.
  963.             Del             - deletes character at the cursor position.  All
  964.                               text to the right of the cursor will be
  965.                               shifted left and a space will be inserted at
  966.                               the end of the field.
  967.             BackSpace       - deletes a character to the left.
  968.             Ctrl-BackSpace  - deletes a word to the left.  Text following
  969.                               the word will be shifted left.
  970.             Ctrl-T          - deletes a word to the right.  Text following
  971.                               the word will be shifted left.
  972.             Ctrl-U          - deletes all characters from current cursor
  973.                               postion to end of field.
  974.             Ctrl-Y          - deletes all characters in all fields from
  975.                               current cursor position to end of last field.
  976.             Esc             - if enabled, cancels input and returns a
  977.                               W_ESCPRESS value.  Escape checking can be
  978.                               enabled or disabled by calling the wsetesc()
  979.                               function before winpread() is called.
  980.  
  981.  
  982.  
  983.  
  984.                                       10
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.     After the winpread() function is called, all fields defined with
  994.     winpdef() will be cleared.  The receiving strings of all defined fields
  995.     will now contain the data entered.  If Escape checking was on and the
  996.     Esc key was pressed, then all receiving strings will contain the values
  997.     they held before winpread() was called and W_ESCPRESS will be returned.
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.                                       11
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.     Bar-Selection Menu Functions.
  1060.  
  1061.     Two functions are needed to use CXL's bar-selection menus:  wmenudef(),
  1062.     and wmenuget().  These two functions can be used as part of a pull-down,
  1063.     pop-up, Lotus-style, or any other bar-selection menu system.  The
  1064.     wmenudef() function defines a menu record in memory and displays the
  1065.     menu option on the screen.  The wmenuget() function processes the user's
  1066.     selection and deallocates the defined menu records.
  1067.  
  1068.     The wmenudef() function accepts 7 parameters.  The first two parameters,
  1069.     wrow and wcol, indicate where in the active window the menu option will
  1070.     be displayed.  The 3rd parameter, attr, is the text attribute of the
  1071.     menu option.  The 4th parameter, str, is the address of the string
  1072.     containing the menu option.  The 5th parameter, tagchar, is used for
  1073.     identification of the menu option. The tag character may be any ASCII
  1074.     character (value 0 - 255).  Lower case tag characters will automatically
  1075.     be converted to upper case.  The 6th parameter, tagattr, is the
  1076.     attribute of the tag character (if the tag character is present in the
  1077.     menu option).  The last parameter, desc, is the address of a text
  1078.     description of the menu option.  This is only used if you plan to use
  1079.     horizontal Lotus-sytle menus, otherwise specify NULL.
  1080.  
  1081.     When all menu options have been defined, you will call the wmenuget()
  1082.     function.  The first argument to wmenuget() is the attribute of the
  1083.     selection bar.  The second argument is the tag character of where you
  1084.     want the selection bar to initially be located.  If an undefined tag
  1085.     character is used, then the initial position of the selection bar will
  1086.     default to the upper-leftmost option.  The third argument of wmenuget()
  1087.     is the pulldown parameter.  This is used for a pull-down menu system.
  1088.     If a pull-down menu system is not being used, then the pulldown
  1089.     parameter should be specified as zero.
  1090.  
  1091.     If you are using pull-down menus, then the pulldown parameter may have
  1092.     one of four values.  PDMAIN is used to signify that the menu you have
  1093.     just defined is to be the main menu (usually the horizontal bar across
  1094.     the top) of a pull-down menu system.  PDMENU is used to signify that the
  1095.     menu you have just defined is one of the pull-down menus from the main
  1096.     menu.  The other two values that the pulldown parameter can have are
  1097.     used for movement between pull-down menus.  PDPREV is used to signify
  1098.     that the menu you have just defined is the main menu and you wish to
  1099.     automatically select the option previous to the specified taginit.
  1100.     PDNEXT is used to signify that the menu you have just defined is the
  1101.     main menu and you wish to automatically select the next option after the
  1102.     specified taginit.
  1103.  
  1104.     A mouse can be used for motion/selection of menu options.  The mouse
  1105.     must first be initialized with a call to msinit().  If you don't
  1106.     find the default mouse sensitivity to your liking, you can adjust
  1107.     the mouse sensitivity by calling msspeed().
  1108.  
  1109.     Keyboard movement/selection keys that can be used during the wmenuget()
  1110.     function are:
  1111.  
  1112.         LeftArrow   - moves selection bar to previous option left.  If
  1113.  
  1114.  
  1115.  
  1116.                                       12
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.                       inside a pull-down menu, pressing this will cause
  1126.                       wmenuget() to return PDPREV.
  1127.         RightArrow  - moves selection bar to next option right.  If inside a
  1128.                       pull-down menu, pressing this will cause wmenuget() to
  1129.                       return PDNEXT.
  1130.         UpArrow     - moves selection bar to previous option up.
  1131.         DownArrow   - moves selection bar to next option down.  If pull-down
  1132.                       menus are being used and you are currently in the main
  1133.                       menu, then the option that the selection bar is on is
  1134.                       selected.
  1135.         Tab         - moves selection bar to next option right.
  1136.         Shift-Tab   - moves selection bar to previous option left.
  1137.         Enter       - selects the option that the selection bar is on.
  1138.                       Pressing the left mouse button will have the same
  1139.                       effect.
  1140.         Home        - moves selection bar to upper left option.
  1141.         End         - moves selection bar to lower right option.
  1142.         Esc         - if enabled, cancels input and returns a zero.  Escape
  1143.                       checking can be enabled or disabled by using the
  1144.                       wsetesc() function before wmenuget() is called.  If
  1145.                       inside a pull-down menu, pressing this will cause
  1146.                       wmenuget() to return PDMAIN.  Pressing the right mouse
  1147.                       button will have the same effect.
  1148.  
  1149.     When an option is selected, it's tag character will be returned by
  1150.     wmenuget().  The tag character will be in the same case as when defined.
  1151.     If the Esc key was pressed and Escape checking was on, a zero will be
  1152.     returned and the global variable _werrno will be set to W_ESCPRESS.  If
  1153.     any other error occurred, the return value will be zero and the global
  1154.     variable _werrno will be set to an error code (see CXLWIN.H).  Once a
  1155.     selection is made, the wmenuget() function automatically clears all menu
  1156.     options defined by wmenudef().
  1157.  
  1158.     If you are using wmenuget() to process a pull-down menu (PDMENU), and
  1159.     the LeftArrow or RightArrow key is pressed, then wmenuget() will return
  1160.     PDPREV or PDNEXT, respectively.  This allows you to input these return
  1161.     values back into the main menu's wmenuget() pulldown parameter to
  1162.     automatically select the previous or next pull-down window from the
  1163.     current pull-down window.  The Escape checking status will be ignored
  1164.     while inside a pull-down menu.  Instead, if in a pull-down menu
  1165.     (PDMENU), and the Esc key is pressed, wmenuget() will return PDMAIN,
  1166.     which allows you to reinput that value back into the main menu's
  1167.     wmenuget() pulldown parameter.  If your pull-down system needs
  1168.     3rd-level menus, they should be defined as pop-up menus (pulldown = 0).
  1169.  
  1170.     Example for a Vertical Pop-Up Menu:
  1171.  
  1172.         int selection;
  1173.                                         /* open the window */
  1174.         wopen(5,10,20,50,4,LMAGENTA|_RED,LMAGENTA|_RED);
  1175.                                         /* define the menu */
  1176.         wmenudef(2,2,LGREEN|_RED,"Add record",'A',WHITE|_RED,NULL);
  1177.         wmenudef(4,2,LGREEN|_RED,"Delete record",'D',WHITE|_RED,NULL);
  1178.         wmenudef(6,2,LGREEN|_RED,"Print record",'P',WHITE|_RED,NULL);
  1179.  
  1180.  
  1181.  
  1182.                                       13
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.         wmenudef(8,2,LGREEN|_RED,"Update record",'U',WHITE|_RED,NULL);
  1192.                                         /* process the menu, load
  1193.                                            selection bar at the
  1194.                                            definition for 'A' */
  1195.         selection=wmenuget(LRED|_GREEN,'A',0);
  1196.         wclose();                       /*  close the window */
  1197.  
  1198.  
  1199.     Example for a Horizontal Lotus-Style Menu:
  1200.  
  1201.         int selection;
  1202.                                         /* open the window */
  1203.         wopen(7,15,10,65,0,YELLOW,LCYAN|_BLUE);
  1204.                                         /* define the menu */
  1205.         wmenudef(0,0,LMAGENTA|_BLUE,"Add",'A',WHITE|_BLUE,
  1206.             "Create a new record");
  1207.         wmenudef(0,8,LMAGENTA|_BLUE,"Delete",'D',WHITE|_BLUE,
  1208.             "Delete an existing record");
  1209.         wmenudef(0,19,LMAGENTA|_BLUE,"Print",'P',WHITE|_BLUE,
  1210.             "Print hardcopy of existing record");
  1211.         wmenudef(0,28,LMAGENTA|_BLUE,"Show",'S',WHITE|_BLUE,
  1212.             "Display an existing record on screen");
  1213.         wmenudef(0,36,LMAGENTA|_BLUE,"Update",'U',WHITE|_BLUE,
  1214.             "Modify an existing record");
  1215.         wmenudef(0,45,LMAGENTA|_BLUE,"Quit",'Q',WHITE|_BLUE,
  1216.             "Quit program and return to DOS");
  1217.         wtextattr(LGREEN|_BLUE);        /* attribute of text description */
  1218.                                         /* process the menu, load the
  1219.                                            selection bar at 'A'dd.       */
  1220.         selection=wmenuget(YELLOW|_LGREY,'A',0);
  1221.         wclose();                       /*  close the window */
  1222.  
  1223.  
  1224.     Model for a Complete Pull-Down Menu System:
  1225.  
  1226.         int m1,m2;
  1227.  
  1228.         m1='F';                         /* init main menu */
  1229.         m2=PDMAIN;
  1230.         while(m1) {                     /* or use " for(;;) { " */
  1231.             wmenudef(     );            /* define main menu */
  1232.             wmenudef(     );
  1233.             wmenudef(     );
  1234.             m1=wmenuget(attrib,m1,m2);  /* get main menu selection */
  1235.             switch(m1) {                /* test main menu selection */
  1236.                 case 'F':
  1237.                     wopen(   );         /* open pull-down menu */
  1238.                     m2='L';             /* init pull-down menu */
  1239.                     while(m2>PDMENU) {
  1240.                         wmenudef(   );  /* define pull-down menu */
  1241.                         wmenudef(   );
  1242.                         wmenudef(   );
  1243.                                         /* get pull-down menu selection */
  1244.                         m2=wmenuget(attrib,m2,PDMENU);
  1245.  
  1246.  
  1247.  
  1248.                                       14
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.                         switch(m2) {    /* test pull-down menu selection */
  1258.                             case 'A':
  1259.                                 funca();
  1260.                                 break
  1261.                             case 'B':
  1262.                                 funcb();
  1263.                                 break;
  1264.                         }
  1265.                     }
  1266.                     wclose();           /* close pull-down menu */
  1267.                     break;
  1268.                 case 'E':
  1269.                     ....
  1270.                     break;
  1271.                 case 'D':
  1272.                     ....
  1273.                     break;
  1274.             }
  1275.         }
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.                                       15
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.     String Selection Functions.
  1324.  
  1325.     There are two functions needed for string selection:  wsseldef() and
  1326.     wsselget().  The wsseldef() function defines a string selection record
  1327.     and is called for every string selection you want to define.
  1328.  
  1329.     The wsselget() function processes all of the defined string selection
  1330.     records and returns the address of the string that was selected.  The
  1331.     following keys can be during string selection:
  1332.  
  1333.         Enter       - selects the displayed selection string
  1334.         LeftArrow   - previous selection string
  1335.         UpArrow     -    "         "       "
  1336.         Shift-Tab   -    "         "       "
  1337.         RightArrow  - next selection string
  1338.         DownArrow   -  "       "       "
  1339.         Tab         -  "       "       "
  1340.         Esc         - if Escape checking is on, then pressing this will
  1341.                       cause wsselget() to return NULL and set the global
  1342.                       variable _werrno to W_ESCPRESS.  Escape checking is
  1343.                       on by default, but you can use wsetesc(0) to turn it
  1344.                       off.
  1345.  
  1346.     This is the way it works:
  1347.  
  1348.         char *prn;
  1349.         FILE *fpout;
  1350.         ....
  1351.         wsseldef("PRN");                /* define each possible string */
  1352.         wsseldef("LPT1");
  1353.         wsseldef("LPT2");
  1354.         wsseldef("COM1");
  1355.         wsseldef("COM2");
  1356.         wputs("Select printer:  ");     /* display prompt */
  1357.         prn=wsselget(YELLOW|_BLUE);     /* get selection from keyboard */
  1358.         if(prn==NULL) {                 /* test for error */
  1359.             error_routine();
  1360.         }
  1361.         fpout=fopen(prn,"w");
  1362.         ....
  1363.  
  1364.     What the display would initially look like is:
  1365.  
  1366.         Select printer:  PRN
  1367.  
  1368.     and by using the arrow keys, you can change the selection.  Once Enter
  1369.     is pressed, the selection will be made.
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.                                       16
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.     Expanded Memory (EMS) Functions.
  1390.  
  1391.     CXL contains several functions for simple management of expanded
  1392.     memory. All of CXL's EMS functions are prefixed with 'ems'.  For those
  1393.     not familiar with expanded memory, I will briefly explain it.
  1394.  
  1395.     The 8088 microprocessor is only able to address 1 Megabyte of memory.
  1396.     When applications started needing more memory, Lotus, Intel, and
  1397.     Microsoft developed the Expanded Memory Specification.  This
  1398.     specification allows access to more than 1 Megabyte of memory by mapping
  1399.     16K 'windows' of memory on an expanded memory board in and out of an
  1400.     unused area of DOS memory.  The Expanded Memory Manager (EMM) is a
  1401.     software driver that controls the mapping.
  1402.  
  1403.     Physical pages are 16K blocks of memory which are located in an unused
  1404.     area of DOS memory.  There are typically 4 physical pages comprising a
  1405.     64K contiguous area of mappable DOS memory.  The EMS page frame base
  1406.     address points to the beginning of the first physical page.  Logical
  1407.     pages are 16K blocks of memory on the expanded memory board.  There can
  1408.     be as many logical pages as the expanded memory board has, up to 8
  1409.     Megabytes.
  1410.  
  1411.     Every program that uses expanded memory must do the following:
  1412.  
  1413.         1.  determine if the EMM device driver is loaded
  1414.         2.  determine if there are enough free pages for its application
  1415.         3.  allocate pages of expanded memory
  1416.         4.  find out what the EMS page frame base address is
  1417.         5.  map logical pages onto physical pages
  1418.         6.  deallocate pages when finished with them
  1419.  
  1420.     Here's an example of using CXL's EMS functions to perform these
  1421.     procedures:
  1422.  
  1423.         int handle1,handle2;
  1424.         char buf[14];
  1425.         if(!emsexist()) {               /*  check for the EMM driver    */
  1426.             printf("EMM not loaded\n");
  1427.             exit(1);
  1428.         }
  1429.         handle1=emsalloc(2);            /*  request 2 pages of EMS
  1430.                                             memory                      */
  1431.         handle2=emsalloc(2);            /*  request 2 more pages        */
  1432.         if(handle1==-1 || handle2==-1) {/*  test for allocation error   */
  1433.             printf("EMS allocation error\n");
  1434.             exit(1);
  1435.         }
  1436.         emsmap(handle1,0,0);            /*  map logical page 0 of handle
  1437.                                             1 to physical page 0        */
  1438.         emswrite("Hello, world",0,13);  /*  write a string at offset 0,
  1439.                                             automatically determines what
  1440.                                             the page frame address is   */
  1441.         emsmap(handle2,0,0);            /*  map logical page 0 of handle
  1442.                                             2 to physical page 0        */
  1443.  
  1444.  
  1445.  
  1446.                                       17
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.         emswrite("How are you?",0,13);  /*  write a string at offset 0  */
  1456.         emsmap(handle1,0,0);            /*  map logical page 0 of handle
  1457.                                             1 to physical page 0        */
  1458.         emsread(buf,0,13);              /*  read 13 bytes from offset 0
  1459.                                             into buffer                 */
  1460.         printf("buf = %s\n",buf);       /*  display buffer contents     */
  1461.         emsmap(handle2,0,0);            /*  map logical page 0 of handle
  1462.                                             2 to physical page 0        */
  1463.         emsread(buf,0,13);              /*  read 13 bytes from offset 0
  1464.                                             into buffer                 */
  1465.         printf("buf = %s\n",buf);       /*  display buffer contents     */
  1466.         emsdealloc(handle2);            /*  deallocate pages belonging
  1467.                                             to handle 2                 */
  1468.         emsdealloc(handle1);            /*  deallocate pages belonging
  1469.                                             to handle 1                 */
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.                                       18
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.     Mouse Functions.
  1522.  
  1523.     CXL has several functions used to facilitate Microsoft compatible mice.
  1524.     All of these functions are prefixed with am 'ms'.  These functions will
  1525.     work on Microsoft mice or other mice using a Microsoft compatible
  1526.     driver.  These mouse functions allow you to:
  1527.  
  1528.         1.  Initialize mouse/determine if mouse exists.
  1529.         2.  Get the status of button presses/releases.
  1530.         3.  Hide/reveal the mouse cursor.
  1531.         4.  Get/set the mouse cursor position.
  1532.         5.  Select type of mouse cursor (hardware or software).
  1533.         6.  Adjust the mouse sensitivity (speed).
  1534.         7.  Get information on direction of mouse movement.
  1535.         8.  Establish horizontal/vertical boundaries of mouse movement.
  1536.  
  1537.     When reading or setting mouse coordinates, the values used are in
  1538.     pixels. To calculate mouse coordinates in terms of column and row
  1539.     instead of X and Y, you would multiply character width by column, and
  1540.     character height by row. Typically, screen characters are 8 pixels wide
  1541.     by 8 pixels tall.  So, to position the mouse cursor at column 60, row
  1542.     15, you would use:
  1543.  
  1544.         msgotoxy(60*8,15*8);
  1545.  
  1546.     The mscursor() function sets the cursor type.  It takes 3 parameters:
  1547.     ctype, smask, and cmask.  If ctype = 1 then the cursor type is hardware.
  1548.     The hardware cursor is the flashing block on your screen.  If this type
  1549.     of cursor is used, it will interfere with normal text cursor functions.
  1550.     When using the hardware cursor type, the value for smask is the start
  1551.     scan line of the cursor, and the value for cmask is the stop scan line
  1552.     of the cursor.  If the ctype parameter = 0, then a software cursor is
  1553.     used.  For the software cursor, the smask parameter is the screen mask,
  1554.     and the cmask parameter is the cursor mask.  The screen mask determines
  1555.     which of the characters attributes are preserved.  The cursor mask
  1556.     defines how the attributes are changed to show the cursor.  For both
  1557.     masks, the bit values are as follows:
  1558.  
  1559.              Bits 0-7:       ASCII value of character
  1560.              Bits 8-10:      Foreground color
  1561.              Bit 11:         Intensity
  1562.              Bits 12-14:     Background color
  1563.              Bit 15:         Blink
  1564.  
  1565.     The msmotion() function determines direction and distance traveled since
  1566.     last msmotion() call.  The xcount and ycount parameters will either be
  1567.     negative or positive depending on direction mouse moved.  The amount
  1568.     will be the number of pixels travelled.
  1569.  
  1570.     When updating the screen, the mouse cursor should be hidden with the
  1571.     mshidecur() function first, and then after the screen is updated, the
  1572.     msshowcur() should be called to re-display the mouse cursor.
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.                                       19
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.                                Global Variables
  1588.  
  1589.  
  1590.     Name:       _dvcheck
  1591.     Purpose:    controls whether or not DESQview is checked for during the
  1592.                 videoinit() call.  By default, videoinit() will check for
  1593.                 the presence of DESQview and request an alternate video
  1594.                 buffer if it exists.  Those running DESQview with QEMM-386
  1595.                 will want to set _dvcheck=0; since QEMM-386 supports
  1596.                 direct video writes.  This global variable must be set prior
  1597.                 to calling videoinit() to have any effect.
  1598.     Type:       int
  1599.  
  1600.  
  1601.     Name:       _kbloop
  1602.     Purpose:    points to a procedure to be called while waiting for a
  1603.                 keypress.
  1604.     Type:       void (*) (void)
  1605.  
  1606.  
  1607.     Name:       _mouse
  1608.     Purpose:    this is set by the msinit() function.  It contains a zero
  1609.                 if a mouse is not installed or a non-zero if mouse is
  1610.                 installed.
  1611.     Type:       int
  1612.  
  1613.  
  1614.     Name:       _onkey
  1615.     Purpose:    a pointer which points to the highest defined onkey record.
  1616.     Type:       struct _onkey_t *   (see CXLKEY.H for definition)
  1617.  
  1618.  
  1619.     Name:       _vbios
  1620.     Purpose:    is used for determined whether screen writes will go
  1621.                 directly to screen memory or use BIOS calls.  Setting
  1622.                 _vbios=1; enable BIOS calls.
  1623.     Type:       int
  1624.  
  1625.  
  1626.     Name:       _videoseg
  1627.     Purpose:    contains the current video RAM segment address used by
  1628.                 direct screen writes.  Defaults to 0xb800.  The videoinit()
  1629.                 function may update this variable.
  1630.     Type:       unsigned int
  1631.  
  1632.  
  1633.     Name:       _werrno
  1634.     Purpose:    contains the error code from the most recently performed
  1635.                 windowing function.  See CXLWIN.H for a complete list of
  1636.                 possible error codes.
  1637.     Type:       int
  1638.  
  1639.  
  1640.     Name:       _wesc
  1641.  
  1642.  
  1643.  
  1644.                                       20
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.     Purpose:    Escape key checking flag.  This is set by the wsetesc()
  1654.                 function and used by several window keyboard input
  1655.                 functions.
  1656.     Type:       int
  1657.  
  1658.  
  1659.     Name:       _whandle
  1660.     Purpose:    contains the last handle number given to a window.
  1661.     Type:       WINDOW
  1662.  
  1663.  
  1664.     Name:       _whrec
  1665.     Purpose:    a pointer to the highest record in the linked list of
  1666.                 hidden records.
  1667.     Type:       struct _wrec_t *   (see CXLWIN.H for definition)
  1668.  
  1669.  
  1670.     Name:       _winp
  1671.     Purpose:    a pointer to the highest defined window keyboard input
  1672.                 record.
  1673.     Type:       struct _winp_t *  (see CXLWIN.H for definition)
  1674.  
  1675.  
  1676.     Name:       _wmenu
  1677.     Purpose:    a pointer to the highest defined bar-selection menu
  1678.                 record.
  1679.     Type:       struct _wmenu_t *  (See CXLWIN.H for definition)
  1680.  
  1681.  
  1682.     Name:       _wrec
  1683.     Purpose:    a pointer to the active window's record.
  1684.     Type:       struct _wrec_t *   (see CXLWIN.H for definition)
  1685.  
  1686.  
  1687.     Name:       _wsel
  1688.     Purpose:    a pointer to the highest defined string selection record.
  1689.     Type:       struct _wsel_t *  (see CXLWIN.H for definition)
  1690.  
  1691.  
  1692.     Name:       _wtotal
  1693.     Purpose:    contains the total number of open windows (doesn't count
  1694.                 hidden windows).
  1695.     Type:       int
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.                                       21
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.                               Library Functions
  1720.  
  1721.  
  1722.     Name:       attrib
  1723.     Purpose:    creates an attribute.
  1724.     Prototype:  int attrib(int fore,int back,int bright,int blink);
  1725.     Header:     cxlvid.h  cxlwin.h
  1726.     Inputs:     fore    - foreground color code (0-7)
  1727.                 back    - background color code (0-7)
  1728.                 bright  - intensity (0-1)
  1729.                 blink   - blinking (0-1)
  1730.     Return:     attribute
  1731.     Also see:   setattr wtextattr
  1732.     Example:
  1733.                 prints(15,10,attrib(7,5,1,0),"Hello, world");
  1734.  
  1735.  
  1736.     Name:       beep
  1737.     Purpose:    sounds a beep in the speaker.
  1738.     Prototype:  void beep(void);
  1739.     Header:     cxldef.h cxlvid.h
  1740.     Inputs:     none
  1741.     Return:     none
  1742.     Also see:   sound_
  1743.     Example:
  1744.                 beep();
  1745.  
  1746.  
  1747.     Name:       biosver
  1748.     Purpose:    returns the ROM BIOS version date.
  1749.     Prototype:  char *biosver(void);
  1750.     Header:     cxldef.h
  1751.     Inputs:     none
  1752.     Return:     address of the static string containing the ROM BIOS
  1753.                 version date
  1754.     Also see:   machid
  1755.     Example:
  1756.                 printf("ROM BIOS version date is %s\n",biosver());
  1757.  
  1758.  
  1759.     Name:       box_
  1760.     Purpose:    displays a text box on the screen.
  1761.     Prototype:  void box_(int srow,int scol,int erow,int ecol,int btype,
  1762.                           int attr);
  1763.     Header:     cxlvid.h
  1764.     Inputs:     srow    - starting row upper left corner
  1765.                 scol    - starting column upper left corner
  1766.                 erow    - ending row lower right corner
  1767.                 ecol    - ending column
  1768.                 btype   - box type (0-5)
  1769.                 attr    - attribute
  1770.     Return:     none
  1771.     Example:
  1772.                 box_(0,0,22,79,1,WHITE|_BLUE);
  1773.  
  1774.  
  1775.  
  1776.                                       22
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.     Name:       capsoff
  1787.     Purpose:    toggles the CapsLock key off.
  1788.     Prototype:  void capsoff(void);
  1789.     Header:     cxlkey.h
  1790.     Inputs:     none
  1791.     Return:     none
  1792.     Also see:   capson kbstat numoff
  1793.     Example:
  1794.                 capsoff();
  1795.  
  1796.  
  1797.     Name:       capson
  1798.     Purpose:    toggles the CapsLock key on.
  1799.     Prototype:  void capson(void);
  1800.     Header:     cxlkey.h
  1801.     Inputs:     none
  1802.     Return:     none
  1803.     Also see:   capsoff kbstat numon
  1804.     Example:
  1805.                 capson();
  1806.  
  1807.  
  1808.     Name:       clearkeys
  1809.     Purpose:    clears the keyboard buffer.
  1810.     Prototype:  void clearkeys(void);
  1811.     Header:     cxlkey.h
  1812.     Inputs:     none
  1813.     Return:     none
  1814.     Also see:   waitkey
  1815.     Example:
  1816.                 clearkeys();
  1817.  
  1818.  
  1819.     Name:       clockcal
  1820.     Purpose:    determines if a clock-calendar board is installed (usually
  1821.                 this board will only be in XT machines).
  1822.     Prototype:  int clockcal(void);
  1823.     Header:     cxldef.h
  1824.     Inputs:     none
  1825.     Return:     a non-zero value if a clock-calendar board is present
  1826.     Example:
  1827.                 printf("A clock-calendar is%s installed\n",
  1828.                     clockcal()?"":" not");
  1829.  
  1830.  
  1831.     Name:       clreol_
  1832.     Purpose:    clears to the end of line using current attribute.
  1833.     Prototype:  void clreol_(void);
  1834.     Header:     cxlvid.h
  1835.     Inputs:     none
  1836.     Return:     none
  1837.     Also see:   clrscrn clrwin
  1838.     Example:
  1839.  
  1840.  
  1841.  
  1842.                                       23
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.                 clreol_();
  1852.  
  1853.  
  1854.     Name:       clrscrn
  1855.     Purpose:    clears the screen (up to 50 lines) using current attribute,
  1856.                 and homes the cursor.
  1857.     Prototype:  void clrscrn(void);
  1858.     Header:     cxlvid.h
  1859.     Inputs:     none
  1860.     Return:     none
  1861.     Also see:   clreol_ clrwin
  1862.     Example:
  1863.                 clrscrn();
  1864.  
  1865.  
  1866.     Name:       clrwin
  1867.     Purpose:    clears a window of the screen using current attribute.
  1868.     Prototype:  void clrwin(srow,scol,erow,ecol);
  1869.     Header:     cxlvid.h
  1870.     Inputs:     srow    - starting row upper left corner
  1871.                 scol    - starting column upper left corner
  1872.                 erow    - ending row lower right corner
  1873.                 ecol    - ending column lower right corner
  1874.     Return:     none
  1875.     Also see:   clreol_ clrscrn
  1876.     Example:
  1877.                 clrwin(11,11,19,19);
  1878.  
  1879.  
  1880.     Name:       cvaltype
  1881.     Purpose:    checks given character against a given CXL character type
  1882.                 code, determines if character is valid type.  This function
  1883.                 is used internally by inputsf(), winpdef(), and winputsf().
  1884.     Prototype:  int cvaltype(int ch,int ctype);
  1885.     Header:     cxlstr.h
  1886.     Inputs:     ch      - character to test
  1887.                 ctype   - character type code to compare with, see section
  1888.                           on CXL format strings for a list of valid
  1889.                           character type codes.
  1890.     Return:     a 0 if character is not valid, a 1 if character is valid, or
  1891.                 a -1 if invalid ctype was given
  1892.                 zero
  1893.     Example:
  1894.                 int valid=0;
  1895.                 char ch='Z';
  1896.                 valid=cvaltype(ch,'#');
  1897.                 printf("%c is %sa valid char of type '#'\n",ch,
  1898.                     valid?"":" not");
  1899.  
  1900.  
  1901.     Name:       delay_
  1902.     Purpose:    delays program execution for a specified duration.
  1903.     Prototype:  void delay_(unsigned duration);
  1904.     Header:     cxldef.h
  1905.  
  1906.  
  1907.  
  1908.                                       24
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.     Inputs:     duration    - duration (0-65535) ie. 18 = 1 second
  1918.     Return:     none
  1919.     Also see:   timer waitkeyt
  1920.     Example:
  1921.                 delay_(36);             /* delays for 2 seconds */
  1922.  
  1923.  
  1924.     Name:       disktoscrn
  1925.     Purpose:    copies a previously saved screen disk file back to the
  1926.                 screen.
  1927.     Prototype:  int disktoscrn(char *fname);
  1928.     Header:     cxlvid.h
  1929.     Inputs:     fname   - address of the string containing file name to
  1930.                           read from.
  1931.     Return:     a zero if no error
  1932.     Also see:   disktowin scrntodisk
  1933.     Example:
  1934.                 if(disktoscrn("SCREEN.DAT")) {
  1935.                     printf("Error reading input file\n");
  1936.                     exit(1);
  1937.                 }
  1938.  
  1939.  
  1940.     Name:       disktowin
  1941.     Purpose:    copies a previously saved window disk file back to the
  1942.                 screen.
  1943.     Prototype:  int disktowin(char *fname);
  1944.     Header:     cxlwin.h
  1945.     Inputs:     fname   - address of the string containing file name to read
  1946.                           from.
  1947.     Return:     a zero if no error
  1948.     Also see:   disktoscrn wintodisk
  1949.     Example:
  1950.                 if(disktowin("WINDOW.DAT")) {
  1951.                     printf("Error reading input file\n");
  1952.                     exit(1);
  1953.                 }
  1954.  
  1955.  
  1956.     Name:       emsalloc
  1957.     Purpose:    allocates pages of EMS memory.  See the "Expanded Memory
  1958.                 (EMS) Functions" section for complete details.
  1959.     Prototype:  int emsalloc(int numpages);
  1960.     Header:     cxlems.h
  1961.     Inputs:     numpages  - the number of pages (16K blocks) requested
  1962.     Return:     the EMS handle or a -1 if an error occurred
  1963.     Also see:   emsdealloc emsexist emsfree
  1964.     Example:
  1965.                 int emm_handle;
  1966.                 ......
  1967.                 emm_handle=emsalloc(2); /*  request 2 pages (32K)   */
  1968.                 if(emm_handle==-1) {
  1969.                     printf("EMS allocation error\n");
  1970.                     exit(1);
  1971.  
  1972.  
  1973.  
  1974.                                       25
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.                 }
  1984.  
  1985.  
  1986.     Name:       emsdealloc
  1987.     Purpose:    deallocate previously allocated pages of EMS memory.
  1988.     Prototype:  int emsdealloc(int handle);
  1989.     Header:     cxlems.h
  1990.     Inputs:     handle  - the previously assigned EMS handle
  1991.     Return:     a 0 if no error or else an EMS error code
  1992.     Also see:   emsalloc
  1993.     Example:
  1994.                 if(emsdealloc(emm_handle)) {
  1995.                     printf("EMS deallocation error\n");
  1996.                     exit(1);
  1997.                 }
  1998.  
  1999.  
  2000.     Name:       emsexist
  2001.     Purpose:    determines if the EMS device driver is loaded.  See the
  2002.                 "Expanded Memory (EMS) Functions" section for complete
  2003.                 details.
  2004.     Prototype:  int emsexist(void);
  2005.     Header:     cxlems.h
  2006.     Inputs:     none
  2007.     Return:     a 0 if EMS driver not loaded, or a 1 if EMS driver is loaded
  2008.     Also see:   emsfree emstotal expmem
  2009.     Example:
  2010.                 printf("EMS device driver is %sloaded\n",
  2011.                     (emsexist())?"":"not ");
  2012.  
  2013.  
  2014.     Name:       emsframe
  2015.     Purpose:    returns the EMS page frame base address (segment).
  2016.     Prototype:  unsigned emsframe(void);
  2017.     Header:     cxlems.h
  2018.     Inputs:     none
  2019.     Return:     the EMS page frame base address (segment) or a zero if an
  2020.                 error occurred.
  2021.     Also see:   emsmap
  2022.     Example:
  2023.                 printf("EMS page frame address is at:  %X\n",emsframe());
  2024.  
  2025.  
  2026.     Name:       emsfree
  2027.     Purpose:    returns the number of free EMS pages (16K blocks).
  2028.     Prototype:  unsigned emsfree(void);
  2029.     Header:     cxlems.h
  2030.     Inputs:     none
  2031.     Return:     the number of free EMS pages
  2032.     Also see:   emsalloc emstotal
  2033.     Example:
  2034.                 printf("Free EMS pages:  %u\n",emsfree());
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.                                       26
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.     Name:       emsmap
  2050.     Purpose:    maps a logical EMS page onto a physical page address.  The
  2051.                 emsalloc() function must be called prior to this.
  2052.     Prototype:  int emsmap(int handle,int lpage,int ppage);
  2053.     Header:     cxlems.h
  2054.     Inputs:     handle  - the EMS handle previosly assigned
  2055.                 lpage   - the logical EMS page to map (0 - ?)
  2056.                 ppage   - the physical DOS page to map to (0 - 3)
  2057.     Return:     a zero if no error, or else an EMS error code
  2058.     Also see:   emsalloc emsframe
  2059.     Example:
  2060.                 if(emsmap(ems_handle,0,0)) {
  2061.                     printf("Error mapping logical page 0 "
  2062.                         "to physical page 0\n");
  2063.                     exit(1);
  2064.                 }
  2065.  
  2066.  
  2067.     Name:       emsread
  2068.     Purpose:    reads bytes from an EMS page(s), emsalloc() and emsmap()
  2069.                 must be called prior to this function.  The source segment
  2070.                 used will be the current EMS page frame address and the
  2071.                 destination segment will be the program's data segment.
  2072.     Prototype:  int emsread(char *dest,unsigned emsofs,unsigned numbytes);
  2073.     Header:     cxlems.h
  2074.     Inputs:     dest     - address to receive bytes read
  2075.                 emsofs   - offset from the EMS page frame base address at
  2076.                            which to read the bytes from.
  2077.                 numbytes - the number of bytes to read
  2078.     Return:     a zero if no error
  2079.     Also see:   emsmap emswrite
  2080.     Example:
  2081.                 if(emsread(buf,0x100,64)) {
  2082.                     printf("Failed to read 64 bytes from EMS memory\n");
  2083.                     exit(1);
  2084.                 }
  2085.  
  2086.  
  2087.     Name:       emstotal
  2088.     Purpose:    returns the total number of EMS pages (16K blocks) on the
  2089.                 system.
  2090.     Prototype:  unsigned emstotal(void);
  2091.     Header:     cxlems.h
  2092.     Inputs:     none
  2093.     Return:     the total number of EMS pages on the system or a zero if an
  2094.                 error occurred.
  2095.     Also see:   emsfree expmem
  2096.     Example:
  2097.                 printf("You have %u pages of EMS memory\n",emstotal());
  2098.  
  2099.  
  2100.     Name:       emsver
  2101.     Purpose:    returns the current EMS version.
  2102.     Prototype:  char *emsver(void);
  2103.  
  2104.  
  2105.  
  2106.                                       27
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.     Header:     cxlems.h
  2116.     Inputs:     none
  2117.     Return:     the address of the static string containing the EMS version
  2118.                 number or NULL if error
  2119.     Example:
  2120.                 printf("Your EMS version is %s\n",emsver());
  2121.  
  2122.  
  2123.     Name:       emswrite
  2124.     Purpose:    writes bytes to an EMS page(s), emsalloc() and emsmap() must
  2125.                 be called prior to this function.  The source segment will
  2126.                 be the program's DATA segment and the destination segment
  2127.                 will be the EMS current EMS page frame address.
  2128.     Prototype:  int emswrite(char *src,unsigned emsofs,unsigned numbytes);
  2129.     Header:     cxlems.h
  2130.     Inputs:     src      - address of where to write bytes from
  2131.                 emsofs   - offset from EMS page frame base address of where
  2132.                            to write bytes to
  2133.                 numbytes - number of bytes to write
  2134.     Return:     a zero if no error
  2135.     Also see:   emsframe emsmap emsread
  2136.     Example:
  2137.                 if(emswrite(buf,0x100,64)) {
  2138.                     printf("Failed to write 64 bytes to EMS memory\n");
  2139.                     exit(1);
  2140.                 }
  2141.  
  2142.  
  2143.     Name:       expmem
  2144.     Purpose:    determines the amount (if any) of expanded memory on the
  2145.                 system.
  2146.     Prototype:  unsigned expmem(void);
  2147.     Header:     cxldef.h cxlems.h
  2148.     Inputs:     none
  2149.     Return:     the amount of expanded memory in kilobytes
  2150.     Also see:   emsexist extmem
  2151.     Example:
  2152.                 printf("Amt of expanded memory = %uK\n",expmem());
  2153.  
  2154.  
  2155.     Name:       extmem
  2156.     Purpose:    determines the amount of extended memory on an AT machine.
  2157.     Prototype:  unsigned extmem(void);
  2158.     Header:     cxldef.h
  2159.     Inputs:     none
  2160.     Return:     the amount of extended memory in kilobytes
  2161.     Also see:   expmem
  2162.     Example:
  2163.                 printf("Amt of extended memory = %uK\n",extmem());
  2164.  
  2165.  
  2166.     Name:       fill_
  2167.     Purpose:    fills in a region of the screen with specified
  2168.                 character/attribute.
  2169.  
  2170.  
  2171.  
  2172.                                       28
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.     Prototype:  void fill_(int srow,int scol,int erow,int ecol,int ch,
  2182.                            int attr);
  2183.     Header:     cxlvid.h
  2184.     Inputs:     srow    - starting row upper left corner
  2185.                 scol    - starting column upper left corner
  2186.                 erow    - ending row lower left corner
  2187.                 ecol    - ending column lower left corner
  2188.                 ch      - character to fill with
  2189.                 attr    - attribute of character
  2190.     Return:     none
  2191.     Also see:   attrib
  2192.     Example:
  2193.                 fill_(2,2,9,9,' ',WHITE|_RED);
  2194.  
  2195.  
  2196.     Name:       gameport
  2197.     Purpose:    determines if a game port is installed.
  2198.     Prototype:  int gameport(void);
  2199.     Header:     cxldef.h
  2200.     Inputs:     none
  2201.     Return:     a zero if game port is not installed, a 1 if installed
  2202.     Also see:   mathchip numflop numpar numser
  2203.     Example:
  2204.                 printf("Game port is %sinstalled\n",
  2205.                     gameport()?"":"not ");
  2206.  
  2207.  
  2208.     Name:       getchf
  2209.     Purpose:    gets a character from the keyboard from a list of valid
  2210.                 characters, provides Escape checking.
  2211.     Prototype:  int getchf(char *valid,int defchar);
  2212.     Header:     cxlkey.h
  2213.     Inputs:     valid   - address of list of valid characters
  2214.                 defchar - default selection in case Enter is pressed, or
  2215.                           a zero for no default
  2216.     Return:     the character pressed or 0 if the Escape key was pressed
  2217.     Also see:   getxch waitkey
  2218.     Example:
  2219.                 int ch;
  2220.                 ......
  2221.                 ch=getchf("YyNn",'N');
  2222.                 if(!ch) {
  2223.                     printf("Escape was pressed\n");
  2224.                     exit(1);
  2225.                 }
  2226.  
  2227.  
  2228.     Name:       getns
  2229.     Purpose:    inputs a string of specified length from the keyboard,
  2230.                 provides Escape checking.
  2231.     Prototype:  int getns(char *str,int max);
  2232.     Header:     cxlkey.h
  2233.     Inputs:     str     - address of allocated space to receive input string
  2234.                 max     - maximum length of the input string
  2235.  
  2236.  
  2237.  
  2238.                                       29
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.     Return:     a 1 if the <Esc> key was pressed
  2248.     Also see:   inputsf
  2249.     Example:
  2250.                 char age[2];
  2251.                 printf("Enter your age:  ");
  2252.                 if(getns(age,2)) {
  2253.                     printf("Escape was pressed\n");
  2254.                     exit(0);
  2255.                 }
  2256.  
  2257.  
  2258.     Name:       getxch
  2259.     Purpose:    gets a key (ASCII code/extended ASCII code) from the
  2260.                 keyboard.  If a mouse is present and initialized, it
  2261.                 can be used.  The mouse movements will translate to
  2262.                 the arrow keys, the left button will translate to
  2263.                 Enter, and the right button will translate to Escape.
  2264.     Prototype:  unsigned getxch(void);
  2265.     Header:     cxlkey.h
  2266.     Inputs:     none
  2267.     Return:     none
  2268.     Also see:   getchf
  2269.     Example:
  2270.                 unsigned int xch;
  2271.                 ......
  2272.                 xch=getxch();
  2273.                 printf("ASCII code = %d, scan code = %d\n",xch,xch>>8);
  2274.  
  2275.  
  2276.     Name:       gotoxy_
  2277.     Purpose:    sets cursor coordinates on the screen.
  2278.     Prototype:  void gotoxy_(int row,int col);
  2279.     Header:     cxlvid.h
  2280.     Inputs:     row     - cursor row (Y coordinate)
  2281.                 col     - cursor column (X coordinate)
  2282.     Return:     none
  2283.     Also see:   readcur
  2284.     Example:
  2285.                 gotoxy_(20,30);     /* set cursor at row 20, column 30 */
  2286.  
  2287.  
  2288.     Name:       inputsf
  2289.     Purpose:    inputs a formatted string from the keyboard.
  2290.     Prototype:  int inputsf(char *str,char *fmt);
  2291.     Header:     cxlkey.h
  2292.     Inputs:     str     - address of the allocated space to receive string
  2293.                 fmt     - address of the format string, see section on using
  2294.                           format strings
  2295.     Return:     0   - no error
  2296.                 1   - Escape key was pressed
  2297.                 2   - invalid format string
  2298.     Also see:   getns
  2299.     Example:
  2300.                 char phone_nr[25];
  2301.  
  2302.  
  2303.  
  2304.                                       30
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.                 ......
  2314.                 inputsf(phone_nr," !RE! 'Enter phone number:  (' ### "
  2315.                                  " ') '###'-'#### ");
  2316.  
  2317.  
  2318.     Name:       kbstat
  2319.     Purpose:    returns the status of the keyboard control keys.
  2320.     Prototype:  unsigned kbstat(void);
  2321.     Header:     cxlkey.h
  2322.     Inputs:     none
  2323.     Return:     status word of the keyboard flag.  You can determine which
  2324.                 key(s) are being pressed/toggled by masking the status with
  2325.                 one of the following:
  2326.                     RSHIFT      - right shift pressed
  2327.                     LSHIFT      - left shift pressed
  2328.                     CTRL        - <Ctrl> pressed
  2329.                     ALT         - <Alt> pressed
  2330.                     SCRLOCK     - <Scroll Lock> toggled
  2331.                     NUMLOCK     - <Num Lock> toggled
  2332.                     CAPSLOCK    - <Caps Lock> toggled
  2333.                     INS         - <Ins> toggled
  2334.     Also see:   capsoff capson numoff numon
  2335.     Example:
  2336.                 if(kbstat()&CTRL) {
  2337.                     printf("The <Ctrl> key is now being pressed\n");
  2338.                 }
  2339.  
  2340.  
  2341.     Name:       lcrlf
  2342.     Purpose:    prints a carriage return and line feed on the printer.
  2343.     Prototype:  void lcrlf(void);
  2344.     Header:     cxlprn.h
  2345.     Inputs:     none
  2346.     Return:     none
  2347.     Also see:   lprintc
  2348.     Example:
  2349.                 lcrlf();
  2350.  
  2351.  
  2352.     Name:       lprintc
  2353.     Purpose:    prints a character on the printer.
  2354.     Prototype:  void lprintc(int ch);
  2355.     Header:     cxlprn.h
  2356.     Inputs:     ch  - the character to print
  2357.     Return:     none
  2358.     Also see:   lcrlf lprintf
  2359.     Example:
  2360.                 lprintc(0x12);  /* sends a form-feed to the printer */
  2361.  
  2362.  
  2363.     Name:       lprintf
  2364.     Purpose:    sends formatted output to the printer, works like printf().
  2365.     Prototype:  void lprintf(const char *format,...);
  2366.     Header:     cxlprn.h
  2367.  
  2368.  
  2369.  
  2370.                                       31
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.     Inputs:     format  - format string, refer to the section on printf() in
  2380.                           the run-time library reference.
  2381.                 ...     - any additional arguments
  2382.     Return:     none
  2383.     Also see:   lprintc lprintns lprints
  2384.     Example:
  2385.                 lprintf("%s %c %d\n",str_arg,char_arg,int_arg);
  2386.  
  2387.  
  2388.     Name:       lprintns
  2389.     Purpose:    prints a string on the printer, formatting width.
  2390.     Prototype:  void lprintns(char *str,int width);
  2391.     Header:     cxlprn.h
  2392.     Inputs:     str     - the address of the string to print
  2393.                 width   - width to print string, uses padding or truncating
  2394.     Return:     none
  2395.     Also see:   lprintf lprints lprintsu
  2396.     Example:
  2397.                 lprintns("Hello, world",5);
  2398.  
  2399.  
  2400.     Name:       lprints
  2401.     Purpose:    prints a string on the printer.
  2402.     Prototype:  void lprints(char *str);
  2403.     Header:     cxlprn.h
  2404.     Inputs:     str     - the address of the string to print
  2405.     Return:     none
  2406.     Also see:   lprintf lprintns lprintsu
  2407.     Example:
  2408.                 lprints("Hello, world\n");
  2409.  
  2410.  
  2411.     Name:       lprintsb
  2412.     Purpose:    prints a bold-faced string on the printer.
  2413.     Prototype:  void lprintsb(char *str);
  2414.     Header:     cxlprn.h
  2415.     Inputs:     str     - the address of the string to print
  2416.     Return:     none
  2417.     Also see:   lprints lprintsu
  2418.     Example:
  2419.                 lprintsb("Hello, world\n");
  2420.  
  2421.  
  2422.     Name:       lprintsu
  2423.     Purpose:    prints an underlined string on the printer.
  2424.     Prototype:  void lprintsu(char *str);
  2425.     Header:     cxlprn.h
  2426.     Inputs:     str     - the address of the string to print
  2427.     Return:     none
  2428.     Also see:   lprints lprintsb
  2429.     Example:
  2430.                 lprintsu("Hello, world\n");
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.                                       32
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.     Name:       machid
  2446.     Purpose:    returns the value of the machine ROM ID byte.
  2447.     Prototype:  int machid(void);
  2448.     Header:     cxldef.h
  2449.     Inputs:     none
  2450.     Return:     the value of the machine ROM ID byte.  Will usually be
  2451.                 one of the following values:
  2452.                     IBMPC       - IBM PC
  2453.                     IBMPCXT     - IBM PC/XT
  2454.                     IBMPCJR     - IBM PCjr
  2455.                     IBMPCAT     - IBM PC/AT
  2456.                     IBMPCXT2    - IBM PC/XT-2
  2457.                     IBMCONV     - IBM PC Convertible
  2458.                     SPERRYPC    - Sperry PC
  2459.     Also see:   biosver
  2460.     Example:
  2461.                 if(machid()==IBMPCAT) printf("You have an IBM PC/AT\n");
  2462.  
  2463.  
  2464.     Name:       mathchip
  2465.     Purpose:    determines if a math coprocessor is installed.
  2466.     Prototype:  int mathchip(void);
  2467.     Header:     cxldef.h
  2468.     Inputs:     none
  2469.     Return:     a 1 if a math coprocessor is installed
  2470.     Also see:   gameport numflop numpar numser
  2471.     Example:
  2472.                 printf("Math coprocessor is %sinstalled\n",
  2473.                     mathchip()?"":"not ");
  2474.  
  2475.  
  2476.     Name:       mode
  2477.     Purpose:    sets the video mode.
  2478.     Prototype:  void mode(int mode_code);
  2479.     Header:     cxlvid.h
  2480.     Inputs:     mode_code   - mode code number
  2481.     Return:     none
  2482.     Also see:   setlines vidtype
  2483.     Example:
  2484.                 mode(4);            /* sets CGA graphics mode */
  2485.  
  2486.  
  2487.     Name:       msbpress
  2488.     Purpose:    gets info about specific button presses of mouse.
  2489.     Prototype:  void msbpress(int button,int *bstat,int *bcount,int *x,
  2490.                               int *y);
  2491.     Header:     cxlmou.h
  2492.     Inputs:     button  - button to check, 0 = left button, 1 = right button
  2493.                 bstat   - address to receive button status (0 = not being
  2494.                           pressed, 1 = currently being pressed)
  2495.                 bcount  - address to receive number of times pressed since
  2496.                           last call
  2497.                 x       - address to receive X pixel coordinate at time of
  2498.                           press
  2499.  
  2500.  
  2501.  
  2502.                                       33
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.                 y       - address to receive Y pixel coordinate at time of
  2512.                           press
  2513.     Return:     none
  2514.     Also see:   msbreles msstatus
  2515.     Example:
  2516.                 int bstat,bcount,x,y;
  2517.                 ......
  2518.                 msbpres(0,&bstat,&bcount,&x,&y);
  2519.  
  2520.  
  2521.     Name:       msbreles
  2522.     Purpose:    gets info about specific button releases of mouse.
  2523.     Prototype:  void msbreles(int button,int *bstat,int *bcount,int *x,
  2524.                               int *y);
  2525.     Header:     cxlmou.h
  2526.     Inputs:     button  - button to check, 0 = left button, 1 = right button
  2527.                 bstat   - address to receive button status (0 = not being
  2528.                           pressed, 1 = currently being pressed)
  2529.                 bcount  - address to receive number of times released since
  2530.                           last call
  2531.                 x       - address to receive X pixel coordinate at time of
  2532.                           release
  2533.                 y       - address to receive Y pixel coordinate at time of
  2534.                           release
  2535.     Return:     none
  2536.     Also see:   msbpress msstatus
  2537.     Example:
  2538.                 int bstat,bcount,x,y;
  2539.                 ......
  2540.                 msbreles(0,&bstat,&bcount,&x,&y);
  2541.  
  2542.  
  2543.     Name:       mscursor
  2544.     Purpose:    sets the mouse cursor mode.
  2545.     Prototype:  void mscursor(int curtype,int smask,int cmask);
  2546.     Header:     cxlmou.h
  2547.     Inputs:     curtype     - cursor type, 0 = software, 1 = hardware
  2548.                 smask       - screen mask (SW) or start scan line (HW), see
  2549.                               section on using mouse functions for a
  2550.                               description of mask
  2551.                 cmask       - cursor mask (SW) or stop scan line (HW), see
  2552.                               section on using mouse functions for a
  2553.                               description of mask
  2554.     Return:     none
  2555.     Also see:   msshowcur
  2556.     Example:
  2557.                 mscursor(1,7,1);
  2558.  
  2559.  
  2560.     Name:       msgotoxy
  2561.     Purpose:    sets the mouse coordinates.
  2562.     Prototype:  void msgotoxy(int x,int y);
  2563.     Header:     cxlmou.h
  2564.     Inputs:     x   -   X pixel coordinate
  2565.  
  2566.  
  2567.  
  2568.                                       34
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.                 y   -   Y pixel coordinate
  2578.     Return:     none
  2579.     Also see:   msstatus
  2580.     Example:
  2581.                 msgotoxy(20*8,10*8);  /* sets mouse cursor at row 10,
  2582.                                          column 20                    */
  2583.  
  2584.  
  2585.     Name:       mshbounds
  2586.     Purpose:    sets the mouse horizontal bounds.
  2587.     Prototype:  void mshbounds(int left,int right);
  2588.     Header:     cxlmou.h
  2589.     Inputs:     left    - left pixel boundary
  2590.                 right   - right pixel boundary
  2591.     Return:     none
  2592.     Also see:   msvbounds
  2593.     Example:
  2594.                   /* limits mouse movement between columns 40 and 60 */
  2595.                 mshbounds(40*8,60*8);
  2596.  
  2597.  
  2598.     Name:       mshidecur
  2599.     Purpose:    hides the mouse cursor.
  2600.     Prototype:  void mshidecur(void);
  2601.     Header:     cxlmou.h
  2602.     Inputs:     none
  2603.     Return:     none
  2604.     Also see:   msshowcur
  2605.     Example:
  2606.                 mshidecur();
  2607.  
  2608.  
  2609.     Name:       msinit
  2610.     Purpose:    determines if mouse is present.  If so, initializes mouse
  2611.                 and sets the global variable _mouse to a non-zero value.
  2612.                 See the "Mouse Functions" section for complete details.
  2613.     Prototype:  int msinit(void);
  2614.     Header:     cxlmou.h
  2615.     Inputs:     none
  2616.     Return:     a 0 if mouse is not present
  2617.     Example:
  2618.                 if(msinit()) {
  2619.                     printf("Mouse initialized!\n");
  2620.                 }
  2621.                 else {
  2622.                     printf("Mouse does not exist\n");
  2623.                 }
  2624.  
  2625.  
  2626.     Name:       msmotion
  2627.     Purpose:    gets information about the movement of mouse.
  2628.     Prototype:  void msmotion(int *xcount,int *ycount);
  2629.     Header:     cxlmou.h
  2630.     Inputs:     xcount   - address to receive amount of X movement in pixels
  2631.  
  2632.  
  2633.  
  2634.                                       35
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.                 ycount   - address to receive amount of Y movement in pixels
  2644.     Return:     none
  2645.     Example:
  2646.                 int xcount,ycount;
  2647.                 ......
  2648.                 msmotion(&xcount,&ycount);
  2649.  
  2650.  
  2651.     Name:       msshowcur
  2652.     Purpose:    reveals the mouse cursor.
  2653.     Prototype:  void msshowcur(void);
  2654.     Header:     cxlmou.h
  2655.     Inputs:     none
  2656.     Return:     none
  2657.     Also see:   mshidecur
  2658.     Example:
  2659.                 msshowcur();
  2660.  
  2661.  
  2662.     Name:       msspeed
  2663.     Purpose:    adjusts mouse speed by changing its sensitivity.
  2664.     Prototype:  void msspeed(int xratio,int yratio);
  2665.     Header:     cxlmou.h
  2666.     Inputs:     xratio      - horizontal speed (higher numbers are slower)
  2667.                 yratio      - vertical speed (higher numbers are slower)
  2668.     Return:     none
  2669.     Example:
  2670.                 msspeed(15,15);
  2671.  
  2672.  
  2673.     Name:       msstatus
  2674.     Purpose:    returns the mouse status.
  2675.     Prototype:  void msstatus(int *bstat,int *x,int *y);
  2676.     Header:     cxlmou.h
  2677.     Inputs:     bstat   - address to receive button status (0 = not pressed,
  2678.                           1 = pressed)
  2679.                 x       - address to receive current X pixel coordinate
  2680.                 y       - address to receive current Y pixel coordinate
  2681.     Return:     none
  2682.     Example:
  2683.                 int bstat,x,y;
  2684.                 ......
  2685.                 msstatus(&bstat,&x,&y);
  2686.  
  2687.  
  2688.     Name:       msvbounds
  2689.     Purpose:    sets the mouse vertical bounds.
  2690.     Prototype:  void msvbounds(int top,int bottom);
  2691.     Header:     cxlmou.h
  2692.     Inputs:     top     - top pixel boundary
  2693.                 bottom  - bottom pixel boundary
  2694.     Return:     none
  2695.     Also see:   mshbounds
  2696.     Example:
  2697.  
  2698.  
  2699.  
  2700.                                       36
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.                 /*  limits mouse movement between rows 10 and 20  */
  2710.                 msvbounds(10*8,20*8);
  2711.  
  2712.  
  2713.     Name:       numflop
  2714.     Purpose:    returns the number of floppy disk drives installed.
  2715.     Prototype:  int numflop(void);
  2716.     Header:     cxldef.h
  2717.     Inputs:     none
  2718.     Return:     the number of floppy disk drives installed
  2719.     Also see:   gameport mathchip numpar numser
  2720.     Example:
  2721.                 printf("Number of floppy disk drives = %d\n",
  2722.                     numflop());
  2723.  
  2724.  
  2725.     Name:       numoff
  2726.     Purpose:    toggles the NumLock key off.
  2727.     Prototype:  void numoff(void);
  2728.     Header:     cxlkey.h
  2729.     Inputs:     none
  2730.     Return:     none
  2731.     Also see:   capsoff kbstat numon
  2732.     Example:
  2733.                 numoff();
  2734.  
  2735.  
  2736.     Name:       numon
  2737.     Purpose:    toggles the NumLock key on.
  2738.     Prototype:  void numon(void);
  2739.     Header:     cxlkey.h
  2740.     Inputs:     none
  2741.     Return:     none
  2742.     Also see:   capson kbstat numoff
  2743.     Example:
  2744.                 numon();
  2745.  
  2746.  
  2747.     Name:       numpar
  2748.     Purpose:    determines the number of parallel ports.
  2749.     Prototype:  int numpar(void);
  2750.     Header:     cxldef.h
  2751.     Inputs:     none
  2752.     Return:     the number of parallel ports installed
  2753.     Also see:   gameport mathchip numflop numser
  2754.     Example:
  2755.                 printf("Number of parallel ports = %d\n",
  2756.                     numpar());
  2757.  
  2758.  
  2759.     Name:       numser
  2760.     Purpose:    determines the number of serial ports installed.
  2761.     Prototype:  int numser(void);
  2762.     Header:     cxldef.h
  2763.  
  2764.  
  2765.  
  2766.                                       37
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.     Inputs:     none
  2776.     Return:     the number of serial ports installed
  2777.     Also see:   gameport mathchip numflop numpar
  2778.     Example:
  2779.                 printf("Number of serial ports = %d\n",
  2780.                     numser());
  2781.  
  2782.  
  2783.     Name:       printc
  2784.     Purpose:    prints a character to the screen at a specified location and
  2785.                 attribute.
  2786.     Prototype:  void printc(int row,int col,int attr,int ch);
  2787.     Header:     cxlvid.h
  2788.     Inputs:     row     - row
  2789.                 col     - column
  2790.                 attr    - attribute of character
  2791.                 ch      - character to print
  2792.     Return:     none
  2793.     Also see:   attrib
  2794.     Example:
  2795.                 printc(18,60,LGREEN|BLINK,'Z');
  2796.  
  2797.  
  2798.     Name:       prints
  2799.     Purpose:    displays a string on the screen at a specified location
  2800.                 and attribute.
  2801.     Prototype:  void prints(int row,int col,int attr,char *str);
  2802.     Header:     cxlvid.h
  2803.     Inputs:     row     - cursor row
  2804.                 col     - cursor column
  2805.                 attr    - character attribute
  2806.                 str     - address of string to display
  2807.     Return:     none
  2808.     Also see:   attrib
  2809.     Example:
  2810.                 prints(20,10,LRED|_LGREY,"Hello, world");
  2811.  
  2812.  
  2813.     Name:       putchat
  2814.     Purpose:    puts a character/attribute at cursor position.
  2815.     Prototype:  void putchat(int ch,int attr);
  2816.     Header:     cxlvid.h
  2817.     Inputs:     ch   - character to display
  2818.                 attr - attribute to display character in
  2819.     Return:     none
  2820.     Also see:   readchat
  2821.     Example:
  2822.                 putchat('C',LRED|BLINK);
  2823.  
  2824.  
  2825.     Name:       readchat
  2826.     Purpose:    reads the character and attribute under the cursor.
  2827.     Prototype:  unsigned readchat(void);
  2828.     Header:     cxlvid.h
  2829.  
  2830.  
  2831.  
  2832.                                       38
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.     Inputs:     none
  2842.     Return:     unsigned integer containing character in low byte and
  2843.                 attribute in high byte
  2844.     Also see:   putchat revattr setattr
  2845.     Example:
  2846.                 int i;
  2847.                 ......
  2848.                 i=readchat();
  2849.                 printf("character is %c and attribute is %d\n",i,(i>>8));
  2850.  
  2851.  
  2852.     Name:       readcur
  2853.     Purpose:    reads the current cursor location.
  2854.     Prototype:  void readcur(int *row,int *col);
  2855.     Header:     cxlvid.h
  2856.     Inputs:     row     - address of location to receive cursor row
  2857.                 col     - address of location to receive cursor column
  2858.     Return:     none
  2859.     Also see:   gotoxy_
  2860.     Example:
  2861.                 int row,col;
  2862.                 ......
  2863.                 readcur(&row,&col);
  2864.  
  2865.  
  2866.     Name:       revattr
  2867.     Purpose:    reverses the attribute of the character under the current
  2868.                 cursor position, continues for the specified number of
  2869.                 characters.
  2870.     Prototype:  void revattr(int count);
  2871.     Header:     cxlvid.h
  2872.     Inputs:     count   - the number of characters to reverse attribute of
  2873.     Return:     none
  2874.     Also see:   readchat setattr
  2875.     Example:
  2876.                 revattr(5);
  2877.  
  2878.  
  2879.     Name:       scrndump
  2880.     Purpose:    dumps the current screen to the printer.
  2881.     Prototype:  void scrndump(void);
  2882.     Header:     cxlprn.h
  2883.     Inputs:     none
  2884.     Return:     none
  2885.     Also see:   scrntodisk ssave videoinit
  2886.     Example:
  2887.                 scrndump();
  2888.  
  2889.  
  2890.     Name:       scrntodisk
  2891.     Purpose:    copies the current screen to a disk file.
  2892.     Prototype:  int scrntodisk(char *fname);
  2893.     Header:     cxlvid.h
  2894.     Inputs:     fname   - address of the string containing file to write to
  2895.  
  2896.  
  2897.  
  2898.                                       39
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.     Return:     a zero if no error
  2908.     Also see:   disktoscrn scrndump ssave wintodisk
  2909.     Example:
  2910.                 if(scrntodisk("SCREEN.DAT")) {
  2911.                     printf("Error creating file\n");
  2912.                     exit(1);
  2913.                 }
  2914.  
  2915.  
  2916.     Name:       setattr
  2917.     Purpose:    sets the attribute of the character under the current cursor
  2918.                 location, continues for the specified number of characters.
  2919.     Prototype:  void setattr(int attr,int count);
  2920.     Header:     cxlvid.h
  2921.     Inputs:     attr    - attribute to set character
  2922.                 count   - the number of characters to set the attribute of
  2923.     Return:     none
  2924.     Also see:   attrib readchat revattr
  2925.     Example:
  2926.                 setattr(LRED|BLINK,5);
  2927.  
  2928.  
  2929.     Name:       setcursz
  2930.     Purpose:    sets the cursor size.
  2931.     Prototype:  void setcursz(int sline,int eline);
  2932.     Header:     cxlvid.h
  2933.     Inputs:     sline   - start line of cursor (32 for no cursor)
  2934.                 eline   - end line of cursor
  2935.     Return:     none
  2936.     Example:
  2937.                 setcursz(1,7);      /* makes a large cursor */
  2938.  
  2939.  
  2940.     Name:       setkbloop
  2941.     Purpose:    sets a procedure that will be called while waiting for
  2942.                 a keypress.
  2943.     Prototype:  void setkbloop( void (*func) (void));
  2944.     Header:     cxlkey.h
  2945.     Inputs:     func    - address of the procedure to be called while
  2946.                           waiting for keypress or NULL to cancel the
  2947.                           procedure.
  2948.     Return:     none
  2949.     Also see:   waitkey waitkeyt
  2950.     Example:
  2951.                 setkbloop(myfunc);
  2952.  
  2953.  
  2954.     Name:       setlines
  2955.     Purpose:    sets the number of lines on the display.
  2956.     Prototype:  int setlines(int numlines);
  2957.     Header:     cxlvid.h
  2958.     Inputs:     numlines    - the number of lines to set the display to,
  2959.                               valid numbers are 25 for all video adapters,
  2960.                               43 for EGA, and 50 for VGA.
  2961.  
  2962.  
  2963.  
  2964.                                       40
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.      Return:     zero if no error
  2974.      Also see:   mode vidtype
  2975.      Example:
  2976.                  if(setlines(43)) {
  2977.                      printf("You need an EGA monitor for 43-line mode\n");
  2978.                  }
  2979.                  else {
  2980.                      printf("You are now in EGA 43-line mode\n");
  2981.                  }
  2982.  
  2983.  
  2984.     Name:       setonkey
  2985.     Purpose:    attaches/detaches a keypress to a function call.  Works by
  2986.                 intercepting any calls to CXL keyboard input functions.
  2987.                 Whenever you use one of CXL's keyboard input functions, the
  2988.                 input function will check to see if the pressed key has been
  2989.                 defined.  If so, then the input function will call the
  2990.                 corresponding function.  If not, then the input function
  2991.                 will pass on the keypress as normal.  This function can be
  2992.                 used for simple context sensitive help by defining the help
  2993.                 key for one procedure and redefining for the next.
  2994.     Prototype:  int setonkey(unsigned keycode,void (*func) (void),int pass);
  2995.     Header:     cxlkey.h
  2996.     Inputs:     keycode - scan code/ASCII code of the keypress to define. If
  2997.                           the keycode was previous defined, it will be
  2998.                           re-defined.  The scan code must be in the upper 8
  2999.                           bits and the ASCII code must be in the lower 8
  3000.                           bits.  For example, the Escape key has a scan code
  3001.                           of 0x01 and an ASCII code of 0x1b, so the value
  3002.                           you would input for keycode would be 0x011b.  You
  3003.                           can use the supplied KEYCODE.EXE program to find
  3004.                           out the keycode for any keypress.
  3005.                 func    - address of the function to call upon keypress.
  3006.                           The called function must have the prototype:
  3007.                                 void func(void);
  3008.                           If NULL is specified for func, then the specified
  3009.                           keycode will be un-defined.
  3010.                 pass    - pass the keypress on to the caller?  0=no, 1=yes
  3011.                           After the function corresponding to the defined
  3012.                           keypress has been called, the keyboard input
  3013.                           function can pass on the keypress to its caller or
  3014.                           it can wait for another keypress.
  3015.     Return:     a zero if no error, otherwise a memory allocation error
  3016.     Example:
  3017.                                     /*  attaches Ctrl-T to myfunc()  */
  3018.                 setonkey(0x1414,myfunc,0);
  3019.  
  3020.  
  3021.     Name:       sound_
  3022.     Purpose:    sounds a tone of specified pitch and duration.
  3023.     Prototype:  void sound_(unsigned pitch,unsigned duration);
  3024.     Header:     cxldef.h
  3025.     Inputs:     pitch       - pitch of tone (0-65535)
  3026.                 duration    - duration of tone (0-65535) ie. 18 = 1 second
  3027.  
  3028.  
  3029.  
  3030.                                       41
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.     Return:     none
  3040.     Also see:   beep
  3041.     Example:
  3042.                 sound_(255,3);
  3043.  
  3044.  
  3045.     Name:       spc
  3046.     Purpose:    displays a specified number of spaces to the screen.
  3047.     Prototype:  void spc(int num);
  3048.     Header:     cxlvid.h
  3049.     Inputs:     num     - number of spaces to display
  3050.     Return:     none
  3051.     Example:
  3052.                 spc(3);
  3053.  
  3054.  
  3055.     Name:       srestore
  3056.     Purpose:    restores a previously saved screen.
  3057.     Prototype:  void srestore(int *sbuf);
  3058.     Header:     cxlvid.h
  3059.     Inputs:     sbuf    - address of previously saved screen buffer
  3060.     Return:     none
  3061.     Also see:   ssave videoinit wrestore
  3062.     Example:
  3063.                 srestore(sbuf);
  3064.  
  3065.  
  3066.     Name:       ssave
  3067.     Purpose:    saves the current screen to a buffer.
  3068.     Prototype:  int *ssave(void);
  3069.     Header:     cxlvid.h
  3070.     Inputs:     none
  3071.     Return:     address of newly created screen buffer or 0 if allocation
  3072.                 error
  3073.     Also see:   scrndump scrntodisk srestore videoinit wsave
  3074.     Example:
  3075.                 int *sbuf;
  3076.                 ......
  3077.                 sbuf=ssave();
  3078.                 if(!sbuf) {
  3079.                     printf("Memory allocation error\n");
  3080.                     exit(1);
  3081.                 }
  3082.  
  3083.  
  3084.     Name:       strblank
  3085.     Purpose:    determines if a given string is blank (whitespace)
  3086.     Prototype:  int strblank(char *str);
  3087.     Header:     cxlstr.h
  3088.     Inputs:     str   - address of the string to check
  3089.     Return:     a 0 if not blank, a 1 if blank
  3090.     Example:
  3091.                 char *str="    ";
  3092.                 printf("str is %sblank\n",strblank(str)?"":"not ");
  3093.  
  3094.  
  3095.  
  3096.                                       42
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.     Name:       strbmatch
  3107.     Purpose:    returns the best match of a string in an array of strings.
  3108.     Prototype:  char *strbmatch(char *str,char *strarr[]);
  3109.     Header:     cxlstr.h
  3110.     Inputs:     str     - address of string to match
  3111.                 strarr  - address of array of string pointers, the last
  3112.                           pointer in the array must be NULL
  3113.     Return:     address of the string in the array that best matched the
  3114.                 given string.
  3115.     Also see:   strmatch
  3116.     Example:
  3117.                 char *strarr[]= { "Hello","Computer","World",NULL };
  3118.                 char *str="xhelpx";
  3119.                 printf("best match is:  %s\n",strbmatch(str,strarr));
  3120.  
  3121.  
  3122.     Name:       strchg
  3123.     Purpose:    finds all letters in a string matching one character and
  3124.                 replaces them with another.
  3125.     Prototype:  int strchg(char *str,int oldch,int newch);
  3126.     Header:     cxlstr.h
  3127.     Inputs:     str     - address of string to search
  3128.                 oldch   - character to search for
  3129.                 newch   - character to replace with
  3130.     Return:     the number of matches found
  3131.     Also see:   strichg
  3132.     Example:
  3133.                 char *str="Hello there";
  3134.                 printf("Before:  %s\n",str);
  3135.                 strchg(str,'h','*');
  3136.                 printf("After:  %s\n",str);
  3137.  
  3138.  
  3139.     Name:       strcode
  3140.     Purpose:    encodes/decodes a string.  Call this function to encode a
  3141.                 string, then call again using the same key to decode.  When
  3142.                 reading or writing from a disk file, be sure to open the
  3143.                 file in binary mode.
  3144.     Prototype:  char *strcode(char *str,char *key);
  3145.     Header:     cxlstr.h
  3146.     Inputs:     str  - the address of the string to encode/decode
  3147.                 key  - the address of the key string to encode/decode with.
  3148.                        The string can consist of any valid characters
  3149.                        (1-255) and can be of any length.  Remember this key
  3150.                        or your data will be lost forever!
  3151.     Return:     the address of the encoded/decoded string
  3152.     Example:
  3153.                 char *str="Hello, world";
  3154.                 printf("Before:   %s\n",str);
  3155.                 strcode(str,"m{&!\xfc");
  3156.                 printf("Encoded:  %s\n",str);
  3157.                 strcode(str,"m{&!\xfc");
  3158.                 printf("Decoded:  %s\n",str);
  3159.  
  3160.  
  3161.  
  3162.                                       43
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.     Name:       strdel
  3173.     Purpose:    deletes a substring from within a string.
  3174.     Prototype:  char *strdel(char *substr,char *str);
  3175.     Header:     cxlstr.h
  3176.     Inputs:     substr  - address of substring to delete
  3177.                 str     - address of string to delete from
  3178.     Return:     a NULL if the substring was not found, or the address of the
  3179.                 modified string.
  3180.     Also see:   stridel strinc strins strmid
  3181.     Example:
  3182.                 char *str="Hello, XXXXXworld";
  3183.                 strdel("XXXXX",str);
  3184.                 printf("%s\n",str);
  3185.  
  3186.  
  3187.     Name:       strichg
  3188.     Purpose:    finds all letters in a string matching one character and
  3189.                 replaces them with another, ignoring case of letters.
  3190.     Prototype:  int strichg(char *str,int oldch,int newch);
  3191.     Header:     cxlstr.h
  3192.     Inputs:     str     - address of string to search
  3193.                 oldch   - character to search for
  3194.                 newch   - character to replace with
  3195.     Return:     the number of matches found
  3196.     Also see:   strchg
  3197.     Example:
  3198.                 char *str="Hello there";
  3199.                 printf("Before:  %s\n",str);
  3200.                 strichg(str,'h','*');
  3201.                 printf("After:  %s\n",str);
  3202.  
  3203.  
  3204.     Name:       stridel
  3205.     Purpose:    deletes a substring from within a string, ignoring case of
  3206.                 letters.
  3207.     Prototype:  char *stridel(char *substr,char *str);
  3208.     Header:     cxlstr.h
  3209.     Inputs:     substr  - address of substring to delete
  3210.                 str     - address of string to delete from
  3211.     Return:     a NULL if the substring was not found, or the address of the
  3212.                 modified string
  3213.     Also see:   strdel striinc
  3214.     Example:
  3215.                 char *str="Hello, XXXXXworld";
  3216.                 stridel("XXXXX",str);
  3217.                 printf("%s\n",str);
  3218.  
  3219.  
  3220.     Name:       striinc
  3221.     Purpose:    determines if one string is included in another, ignoring
  3222.                 case of letters.
  3223.     Prototype:  char *striinc(char *str1,char *str2);
  3224.     Header:     cxlstr.h
  3225.  
  3226.  
  3227.  
  3228.                                       44
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.     Inputs:     str1    - address of string1
  3238.                 str2    - address of string2
  3239.     Return:     the address where string1 is included in string2, or a NULL
  3240.                 if string1 is not included in string2
  3241.     Also see:   strinc strmid
  3242.     Example:
  3243.                 char *str1="HeLlo WOrLd";
  3244.                 char *str2="XXXXXXXHello, worldXXXXX";
  3245.                 if(striinc(str1,str2)) {
  3246.                     printf("%s is included in %s\n",str1,str2);
  3247.                 }
  3248.  
  3249.  
  3250.     Name:       strinc
  3251.     Purpose:    determines if one string is included in another.
  3252.     Prototype:  char *strinc(char *str1,char *str2);
  3253.     Header:     cxlstr.h
  3254.     Inputs:     str1    - address of string1
  3255.                 str2    - address of string2
  3256.     Return:     the address where string1 is included in string2, or a NULL
  3257.                 if string1 is not included in string2
  3258.     Also see:   striinc strmid
  3259.     Example:
  3260.                 char *str1="Hello world";
  3261.                 char *str2="XXXXXXXHello, worldXXXXX";
  3262.                 if(strinc(str1,str2)) {
  3263.                     printf("%s is included in %s\n",str1,str2);
  3264.                 }
  3265.  
  3266.  
  3267.     Name:       strins
  3268.     Purpose:    inserts one string into another.
  3269.     Prototype:  char *strins(char *instr,char **str,int st_pos);
  3270.     Header:     cxlstr.h
  3271.     Inputs:     instr   - the address of the string to insert
  3272.                 str     - the address of the address of the string to
  3273.                           insert into
  3274.                 st_pos  - the starting position for where to insert
  3275.     Return:     the address of the newly allocated string, or a NULL if a
  3276.                 memory allocation error occurred
  3277.     Also see:   strdel strinc
  3278.     Example:
  3279.                 char *str="Hello!";
  3280.                 printf("%s\n",str);
  3281.                 strins(", world",&str,5);
  3282.                 printf("%s\n",str);
  3283.                 free(str);  /* free memory when done with string */
  3284.  
  3285.  
  3286.     Name:       striocc
  3287.     Purpose:    returns the number of occurrences of a character in a string
  3288.                 ignoring the case of letters.
  3289.     Prototype:  int striocc(char *str,int ch);
  3290.     Header:     cxlstr.h
  3291.  
  3292.  
  3293.  
  3294.                                       45
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.     Inputs:     str     - address of the string to search
  3304.                 ch      - the character to look for
  3305.     Return:     the number of occurrences of the character in the string
  3306.     Also see:   strocc
  3307.     Example:
  3308.                 char ch='L';
  3309.                 char *str="Hello, world";
  3310.                 printf("%c occurs in %s %d times\n",ch,str,
  3311.                     striocc(str,ch));
  3312.  
  3313.  
  3314.     Name:       strleft
  3315.     Purpose:    takes a specified portion of a string from the left and
  3316.                 creates a new string.
  3317.     Prototype:  char *strleft(char *str,int num_chars);
  3318.     Header:     cxlstr.h
  3319.     Inputs:     str         - address of input string
  3320.                 num_chars   - number of characters to copy
  3321.     Return:     address of the newly created string or a NULL if a memory
  3322.                 allocation error occurred
  3323.     Also see:   strmid strright strtrim
  3324.     Example:
  3325.                 char *left;
  3326.                 char *str="Hello, worldXXXX";
  3327.                 left=strleft(str,12);
  3328.                 printf("%s\n",left);
  3329.                 free(left);  /* free memory when done with string */
  3330.  
  3331.  
  3332.     Name:       strltrim
  3333.     Purpose:    trims leading spaces off of a string.
  3334.     Prototype:  char *strtrim(char *str);
  3335.     Header:     cxlstr.h
  3336.     Inputs:     str  - address of the string to trim
  3337.     Return:     address of the modified string
  3338.     Also see:   strright strsetsz strtrim
  3339.     Example:
  3340.                 char *str="        Hello, world";
  3341.                 printf("Before:  %s.\n",str);
  3342.                 strltrim(str);
  3343.                 printf("After:   %s.\n",str);
  3344.  
  3345.  
  3346.     Name:       strmatch
  3347.     Purpose:    compares 2 strings, returns a match score.
  3348.     Prototype:  int strmatch(char *str1,char *str2);
  3349.     Header:     cxlstr.h
  3350.     Inputs:     str1    - address of first string
  3351.                 str2    - address of second string
  3352.     Return:     a match score, the higher the score, the better they match
  3353.     Also see:   strbmatch
  3354.     Example:
  3355.                 char *str1="hello";
  3356.                 char *str2="help";
  3357.  
  3358.  
  3359.  
  3360.                                       46
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.                 printf("match score = %d\n",strmatch(str1,str2));
  3370.  
  3371.  
  3372.     Name:       strmid
  3373.     Purpose:    takes a section from input string starting at given position
  3374.                 and taking the given amount of characters creating a new
  3375.                 string.
  3376.     Prototype:  char *strmid(char *str,int st_pos,int num_chars);
  3377.     Header:     cxlstr.h
  3378.     Inputs:     str         - address of input string
  3379.                 st_pos      - position in input string to start copying
  3380.                               characters (starting at position 0)
  3381.                 num_chars   - number of characters to copy
  3382.     Return:     address of the newly created string or a NULL if a memory
  3383.                 allocation error occurred
  3384.     Also see:   strleft strright
  3385.     Example:
  3386.                 char *middle;
  3387.                 char *str="XXXXXHello, worldXXXX";
  3388.                 middle=strmid(str,5,12);
  3389.                 printf("%s\n",middle);
  3390.                 free(middle);   /* free memory when done with string */
  3391.  
  3392.  
  3393.     Name:       strocc
  3394.     Purpose:    returns the number of occurrences of a character in a
  3395.                 string.
  3396.     Prototype:  int strocc(char *str,int ch);
  3397.     Header:     cxlstr.h
  3398.     Inputs:     str     - address of the string to search
  3399.                 ch      - the character to look for
  3400.     Return:     the number of occurrences of the character in the string
  3401.     Also see:   striocc
  3402.     Example:
  3403.                 char ch='l';
  3404.                 char *str="Hello, world";
  3405.                 printf("%c occurs in %s %d times\n",ch,str,strocc(str,ch));
  3406.  
  3407.  
  3408.     Name:       strright
  3409.     Purpose:    takes a specifed portion from the right side of a string
  3410.                 creating a new string.
  3411.     Prototype:  char *strright(char *str,int num_chars);
  3412.     Header:     cxlstr.h
  3413.     Inputs:     str         - address of input string
  3414.                 num_chars   - number of characters to copy
  3415.     Return:     address of the newly created string or a NULL if a memory
  3416.                 allocation error occurred
  3417.     Also see:   strleft strltrim strmid
  3418.     Example:
  3419.                 char *right;
  3420.                 char *str="XXXXXHello, world";
  3421.                 right=strright(str,12);
  3422.                 printf("%s\n",right);
  3423.  
  3424.  
  3425.  
  3426.                                       47
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.                 free(right);    /* free memory when done with string */
  3436.  
  3437.  
  3438.     Name:       strrol
  3439.     Purpose:    rotates a string specified number of characters left,
  3440.                 characters wrap around.
  3441.     Prototype:  char *strrol(char *str,int count);
  3442.     Header:     cxlstr.h
  3443.     Inputs:     str    - the address of the string to rotate
  3444.                 count  - number of characters to rotate
  3445.     Return:     the address of the modified string
  3446.     Also see:   strror strshl
  3447.     Example:
  3448.                 char *str="Hello, world";
  3449.                 printf("Before:  %s.\n",str);
  3450.                 strrol(str,3);
  3451.                 printf("After:   %s.\n",str);
  3452.  
  3453.  
  3454.     Name:       strror
  3455.     Purpose:    rotates a string specified number of characters right,
  3456.                 characters wrap around.
  3457.     Prototype:  char *strror(char *str,int count);
  3458.     Header:     cxlstr.h
  3459.     Inputs:     str    - the address of the string to rotate
  3460.                 count  - number of characters to rotate
  3461.     Return:     the address of the modified string
  3462.     Also see:   strrol strshr
  3463.     Example:
  3464.                 char *str="Hello, world";
  3465.                 printf("Before:  %s.\n",str);
  3466.                 strror(str,3);
  3467.                 printf("After:   %s.\n",str);
  3468.  
  3469.  
  3470.     Name:       strsetsz
  3471.     Purpose:    adjusts the length of a string by truncation or padding with
  3472.                 spaces.
  3473.     Prototype:  char *strsetsz(char **str,int newsize);
  3474.     Header:     cxlstr.h
  3475.     Inputs:     str     - address of pointer to the string
  3476.                 newsize - the new length of the string
  3477.     Return:     address of the new string or a NULL if a memory allocation
  3478.                 error occurred.
  3479.     Also see:   strtrim
  3480.     Example:
  3481.                 char *str="Hello, world";
  3482.                 strsetsz(&str,25);
  3483.                 printf("%s.\n",str);
  3484.                 strsetsz(&str,5);
  3485.                 printf("%s.\n",str);
  3486.  
  3487.  
  3488.     Name:       strshl
  3489.  
  3490.  
  3491.  
  3492.                                       48
  3493.  
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.     Purpose:    shifts a string specified number of characters left,
  3502.                 characters 'drop off' and spaces are added to the string.
  3503.     Prototype:  char *strshl(char *str,int count);
  3504.     Header:     cxlstr.h
  3505.     Inputs:     str    - the address of the string to shift
  3506.                 count  - number of characters to shift
  3507.     Return:     the address of the modifed string
  3508.     Also see:   strrol strshr
  3509.     Example:
  3510.                 char *str="Hello, world";
  3511.                 printf("Before:  %s.\n",str);
  3512.                 strshl(str,3);
  3513.                 printf("After:   %s.\n",str);
  3514.  
  3515.  
  3516.     Name:       strshr
  3517.     Purpose:    shifts a string specified number of characters right,
  3518.                 characters 'drop off' and spaces are added to the string.
  3519.     Prototype:  char *strshr(char *str,int count);
  3520.     Header:     cxlstr.h
  3521.     Inputs:     str    - the address of the string to shift
  3522.                 count  - number of characters to shift
  3523.     Return:     the address of the modified string
  3524.     Also see:   strror strshl
  3525.     Example:
  3526.                 char *str="Hello, world";
  3527.                 printf("Before:  %s.\n",str);
  3528.                 strshr(str,3);
  3529.                 printf("After:   %s.\n",str);
  3530.  
  3531.  
  3532.     Name:       strtrim
  3533.     Purpose:    trims trailing spaces off of a string.
  3534.     Prototype:  char *strtrim(char *str);
  3535.     Header:     cxlstr.h
  3536.     Inputs:     str  - address of the string to trim
  3537.     Return:     address of the modified string
  3538.     Also see:   strleft strltrim strsetsz
  3539.     Example:
  3540.                 char *str="Hello, world          ";
  3541.                 printf("Before:  %s.\n",str);
  3542.                 strtrim(str);
  3543.                 printf("After:   %s.\n",str);
  3544.  
  3545.  
  3546.     Name:       struplow
  3547.     Purpose:    converts a string to mixed upper & lower case characters.
  3548.     Prototype:  char *struplow(char *str);
  3549.     Header:     cxlstr.h
  3550.     Inputs:     str   - the address of the string to convert
  3551.     Return:     the address of the modified string
  3552.     Also see:   touplow
  3553.     Example:
  3554.                 char *str="heLlO, wOrLd";
  3555.  
  3556.  
  3557.  
  3558.                                       49
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.                 printf("Before:  %s.\n",str);
  3568.                 struplow(str);
  3569.                 printf("After:   %s.\n",str);
  3570.  
  3571.  
  3572.     Name:       sysdate
  3573.     Purpose:    returns a string containing the current system date.
  3574.     Prototype:  char *sysdate(int dtype);
  3575.     Header:     cxldef.h
  3576.     Inputs:     dtype   - date type code.  Can be one of the following:
  3577.                                Code     Example
  3578.                                ----     -------
  3579.                                 0       December 3, 1988
  3580.                                 1       3 Dec 88
  3581.                                 2       12-3-88
  3582.                                 3       12/3/88
  3583.                                 4       3/12/88
  3584.     Return:     the address of the static string containing the system date.
  3585.     Also see:   systime
  3586.     Example:
  3587.                 printf("The system date is:  %s\n",sysdate(0));
  3588.  
  3589.  
  3590.     Name:       systime
  3591.     Purpose:    returns a string containing the system time.
  3592.     Prototype:  char *systime(int ttype);
  3593.     Header:     cxldef.h
  3594.     Inputs:     ttype   - time type code.  Can be one of the following:
  3595.                                Code     Example
  3596.                                ----     -------
  3597.                                 0       16:30:57.89
  3598.                                 1       16:30:57
  3599.                                 2       4:30 PM
  3600.                                 3       4:30p
  3601.                                 4       4:30
  3602.     Return:     the address of the static string containing the system time.
  3603.     Also see:   sysdate
  3604.     Example:
  3605.                 printf("The current system time is:  %s\n",systime(2));
  3606.  
  3607.  
  3608.     Name:       tabstop
  3609.     Purpose:    calculates a tab stop from given column and tab width.
  3610.     Prototype:  int tabstop(int col,int tabwidth);
  3611.     Header:     cxldef.h
  3612.     Inputs:     col         - column
  3613.                 tabwidth    - tab width
  3614.     Return:     the next tab stop column
  3615.     Example:
  3616.                 printf("The next tab stop after column 5 is %d\n",
  3617.                     tabstop(5,8));
  3618.  
  3619.  
  3620.     Name:       timer
  3621.  
  3622.  
  3623.  
  3624.                                       50
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.     Purpose:    returns the value of the BIOS timer.
  3634.     Prototype:  unsigned long timer(void);
  3635.     Header:     cxldef.h
  3636.     Inputs:     none
  3637.     Return:     current value of the BIOS timer
  3638.     Also see:   delay_
  3639.     Example:
  3640.                 printf("%lu\n",timer());
  3641.                 delay_(36);
  3642.                 printf("%lu\n",timer());
  3643.  
  3644.  
  3645.     Name:       touplow
  3646.     Purpose:    converts a character to upper or lower case depending on
  3647.                 previous character.
  3648.     Prototype:  int touplow(char *str,char *pos,int ch);
  3649.     Header:     cxlstr.h
  3650.     Inputs:     str     - address of string
  3651.                 pos     - current position in string
  3652.                 ch      - character to convert
  3653.     Return:     the converted character
  3654.     Also see:   struplow
  3655.     Example:
  3656.                 char *str="Hello, world";
  3657.                 printf("Before: %s\n",str);
  3658.                 *(str+7)=touplow(str,str+7,*(str+7));
  3659.                 printf("After:  %s\n",str);
  3660.  
  3661.  
  3662.     Name:       videoinit
  3663.     Purpose:    initializes CXL's video system.  By default all CXL
  3664.                 functions performing direct screen writes go to the CGA
  3665.                 video RAM segment at 0xb800.  If you want these functions to
  3666.                 work correctly with a monochrome video adapter or within a
  3667.                 DESQview window, you must call this function.  This function
  3668.                 sets the value of the global variable _videoseg.
  3669.     Prototype:  void videoinit(void);
  3670.     Header:     cxlvid.h  cxlwin.h
  3671.     Inputs:     none
  3672.     Return:     none
  3673.     Also see:   vidtype
  3674.     Example:
  3675.                 videoinit();
  3676.  
  3677.  
  3678.     Name:       vidtype
  3679.     Purpose:    determines the display adapter type.
  3680.     Prototype:  int vidtype(void);
  3681.     Header:     cxlvid.h
  3682.     Inputs:     none
  3683.     Return:     video adapter type.  Will be one of the following values:
  3684.                     MDA     - Monochrome Display Adapter
  3685.                     HGC     - Hercules Graphics Card
  3686.                     HGCPLUS - Hercules Graphics Card Plus
  3687.  
  3688.  
  3689.  
  3690.                                       51
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.                     INCOLOR - Hercules InColor card
  3700.                     CGA     - Color Graphics Adapter
  3701.                     EGA     - Enhanced Graphics Adapter
  3702.                     VGA     - Video Graphics Array adapter
  3703.     Also see:   mode videoinit
  3704.     Example:
  3705.                 int vid_adapt;
  3706.                 vid_adapt=vidtype();
  3707.                 if(vid_adapt>HGCPLUS) {
  3708.                     printf("A color adapter is installed\n");
  3709.                 }
  3710.  
  3711.  
  3712.     Name:       wactiv
  3713.     Purpose:    activates a previously opened window.
  3714.     Prototype:  int wactiv(WINDOW whandle);
  3715.     Header:     cxlwin.h
  3716.     Inputs:     whandle     - the window handle returned from the wopen()
  3717.                               function
  3718.     Return:     W_NOERROR   - no error
  3719.                 W_NOTFOUND  - window handle not found
  3720.                 W_NOACTIVE  - no open windows
  3721.     Also see:   wisactiv wopen
  3722.     Example:
  3723.                 int window_handle;
  3724.                 ......
  3725.                 wactiv(window_handle);
  3726.  
  3727.  
  3728.     Name:       waitkey
  3729.     Purpose:    halts execution until a key is pressed, the keyboard buffer
  3730.                 is cleared first.
  3731.     Prototype:  int waitkey(void);
  3732.     Header:     cxlkey.h
  3733.     Inputs:     none
  3734.     Return:     the ASCII value of the key pressed
  3735.     Also see:   clearkeys getchf waitkeyt
  3736.     Example:
  3737.                 waitkey();
  3738.  
  3739.  
  3740.     Name:       waitkeyt
  3741.     Purpose:    halts execution until a key is pressed or the specified time
  3742.                 limit expires, the keyboard buffer is cleared first.
  3743.     Prototype:  int waitkeyt(int duration);
  3744.     Header:     cxlkey.h
  3745.     Inputs:     duration - length of time to wait for keypress (18 = 1 sec)
  3746.     Return:     the ASCII value of the key pressed or a -1 if time expired
  3747.     Also see:   clearkeys delay_ getchf waitkey
  3748.     Example:
  3749.                 waitkeyt(182);  /* wait for a max of 10 seconds */
  3750.  
  3751.  
  3752.     Name:       wblocked
  3753.  
  3754.  
  3755.  
  3756.                                       52
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.     Purpose:    determines if a window is being blocked by any other
  3766.                 windows.
  3767.     Prototype:  int wblocked(WINDOW whandle);
  3768.     Header:     cxlwin.h
  3769.     Inputs:     whandle   - handle of window to check
  3770.     Return:     -1    - error.  The global variable _werrno will be set to
  3771.                         one of the following:
  3772.                             W_NOACTIVE  - no active window
  3773.                             W_NOTFOUND  - window handle not found
  3774.                  0    - window is not blocked
  3775.                  1    - window is blocked
  3776.     Also see:   wisactiv
  3777.     Example:
  3778.                 WINDOW w1,w2;
  3779.                 w1=wopen(0,0,10,20,0,LCYAN|_BLUE,LCYAN|_BLUE);
  3780.                 w2=wopen(8,8,15,40,0,LMAGENTA|_RED,LMAGENTA|_RED);
  3781.                 wopen(5,45,15,75,0,YELLOW|_GREEN,YELLOW|_GREEN);
  3782.                 printf("the blue window is %sblocked\n",
  3783.                     wblocked(w1)?"":"not ");
  3784.                 printf("the red window is %sblocked\n",
  3785.                     wblocked(w2)?"":"not ");
  3786.  
  3787.  
  3788.     Name:       wborder
  3789.     Purpose:    changes the active window's border box type.
  3790.     Prototype:  int wborder(int btype);
  3791.     Header:     cxlwin.h
  3792.     Inputs:     btype   - box type (0-5).  Use btype 5 for a borderless
  3793.                           window.
  3794.     Return:     W_NOERROR   - no error
  3795.                 W_NOACTIVE  - no active window
  3796.                 W_INVBTYPE  - invalid box type
  3797.     Example:
  3798.                 wborder(1);
  3799.  
  3800.  
  3801.     Name:       wbox
  3802.     Purpose:    displays a text box in active window.
  3803.     Prototype:  int wbox(int wsrow,int wscol,int werow,int wecol,int btype,
  3804.                          int attr);
  3805.     Header:     cxlwin.h
  3806.     Inputs:     wsrow   - window start row
  3807.                 wscol   - window start column
  3808.                 werow   - window end row
  3809.                 wecol   - window end column
  3810.                 btype   - box type (0-5)
  3811.                 attr    - attribute
  3812.     Return:     W_NOERROR   - no error
  3813.                 W_NOACTIVE  - no active window
  3814.                 W_INVCOORD  - invalid coordinates
  3815.     Also see:   wfill whline wvline
  3816.     Example:
  3817.                 wbox(2,2,10,20,0,LMAGENTA|_RED);
  3818.  
  3819.  
  3820.  
  3821.  
  3822.                                       53
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.     Name:       wcclear
  3832.     Purpose:    clears the currently active window using specified
  3833.                 attribute.
  3834.     Prototype:  int wcclear(int attr);
  3835.     Header:     cxlwin.h
  3836.     Inputs:     none
  3837.     Return:     W_NOERROR   - no error
  3838.                 W_NOACTIVE  - no active window
  3839.     Also see:   wclear wclreol wclreos
  3840.     Example:
  3841.                 wcclear(LBLUE|_RED);
  3842.  
  3843.  
  3844.     Name:       wcenters
  3845.     Purpose:    displays a string centered in active window.
  3846.     Prototype:  int wcenters(int wrow,int attr,char *str);
  3847.     Inputs:     wrow    - window row
  3848.                 attr    - attribute
  3849.                 str     - address of string to display
  3850.     Return:     W_NOERROR   - no error
  3851.                 W_NOACTIVE  - no active window
  3852.                 W_INVCOORD  - invalid window row
  3853.                 W_STRLONG   - string too long to be centered in window
  3854.     Also see:   wprints wrjusts
  3855.     Example:
  3856.                 wcenters(2,LBLUE,"Hello, world");
  3857.  
  3858.  
  3859.     Name:       wchgattr
  3860.     Purpose:    changes attribute of the active window, all text within the
  3861.                 window will be changed also.
  3862.     Prototype:  int wchgattr(int battr,int wattr);
  3863.     Header:     cxlwin.h
  3864.     Inputs:     battr   - the attribute to make the window's border
  3865.                 wattr   - the attribute to make the window
  3866.     Return:     W_NOERROR   - no error
  3867.                 W_NOACTIVE  - no active window
  3868.     Also see:   wtextattr
  3869.     Example:
  3870.                 wchgattr(LMAGENTA|_RED,YELLOW|_BLUE);
  3871.  
  3872.  
  3873.     Name:       wclear
  3874.     Purpose:    clears the currently active window.
  3875.     Prototype:  int wclear(void);
  3876.     Header:     cxlwin.h
  3877.     Inputs:     none
  3878.     Return:     W_NOERROR   - no error
  3879.                 W_NOACTIVE  - no active window
  3880.     Also see:   wcclear wclreol wclreos
  3881.     Example:
  3882.                 wclear();
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.                                       54
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.     Name:       wclose
  3898.     Purpose:    closes the currently active window.
  3899.     Prototype:  int wclose(void);
  3900.     Header:     cxlwin.h
  3901.     Inputs:     none
  3902.     Return:     W_NOERROR   - no error
  3903.                 W_NOACTIVE  - no active window
  3904.     Also see:   wcloseall wopen
  3905.     Example:
  3906.                 wclose();
  3907.  
  3908.  
  3909.     Name:       wcloseall
  3910.     Purpose:    closes all open windows.
  3911.     Prototype:  int wcloseall(void);
  3912.     Header:     cxlwin.h
  3913.     Inputs:     none
  3914.     Return:     W_NOERROR   - no error
  3915.                 W_NOACTIVE  - no active window
  3916.     Also see:   wclose
  3917.     Example:
  3918.                 wcloseall();
  3919.  
  3920.  
  3921.     Name:       wclreol
  3922.     Purpose:    clears to the end of the active window's line.
  3923.     Prototype:  int wclreol(void);
  3924.     Header:     cxlwin.h
  3925.     Inputs:     none
  3926.     Return:     W_NOERROR   - no error
  3927.                 W_NOACTIVE  - no active window
  3928.     Also see:   wclear wclreos
  3929.     Example:
  3930.                 wclreol();
  3931.  
  3932.  
  3933.     Name:       wclreos
  3934.     Purpose:    clears from current cursor position to the end of
  3935.                 the active window.
  3936.     Prototype:  int wclreos(void);
  3937.     Header:     cxlwin.h
  3938.     Inputs:     none
  3939.     Return:     W_NOERROR   - no error
  3940.                 W_NOACTIVE  - no active window
  3941.     Also see:   wclear wclreol
  3942.     Example:
  3943.                 wclreos();
  3944.  
  3945.  
  3946.     Name:       wcopy
  3947.     Purpose:    creates a new window duplicating the active window, the new
  3948.                 window becomes the active window.
  3949.     Prototype:  WINDOW wcopy(int nsrow,int nscol);
  3950.     Header:     cxlwin.h
  3951.  
  3952.  
  3953.  
  3954.                                       55
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.     Inputs:     nsrow   - start row of the duplicate window
  3964.                 nscol   - start column of the duplicate window
  3965.     Return:     the handle of the new window or a zero if an error occurred.
  3966.                 If error, the global variable _werrno will be set to one of
  3967.                 the following:  W_ALLOCERR  - memory allocation error
  3968.                                 W_INVCOORD  - invalid coordinates
  3969.     Also see:   wactiv wmove wopen
  3970.     Example:
  3971.                 wcopy(10,20);   /* make copy of active window at
  3972.                                    row 10, col 20                */
  3973.  
  3974.  
  3975.     Name:       wdelline
  3976.     Purpose:    deletes a line in active window
  3977.     Prototoype: int wdelline(int wrow,int direc);
  3978.     Header:     cxlwin.h
  3979.     Inputs:     wrow    - window row to delete
  3980.                 direc   - scroll direction:
  3981.                                 SUP    - scroll up
  3982.                                 SDOWN  - scroll down
  3983.     Return:     W_NOERROR   - no error
  3984.                 W_NOACTIVE  - no active window
  3985.                 W_INVCOORD  - invalid window row
  3986.     Also see:   winsline wscroll
  3987.     Example:
  3988.                 wdelline(4,SDOWN);
  3989.  
  3990.  
  3991.     Name:       wdupc
  3992.     Purpose:    displays a character specified number of times in active
  3993.                 window.  Characters will be displayed in the attribute set
  3994.                 by the wtextattr() function.  Control characters are
  3995.                 recognized.  Cursor position is updated.
  3996.     Prototype:  int wdupc(int ch,int count);
  3997.     Header:     cxlwin.h
  3998.     Inputs:     ch      - character to be displayed
  3999.                 count   - number of times to display character
  4000.     Return:     W_NOERROR   - no error
  4001.                 W_NOACTIVE  - no active window
  4002.     Also see:   wputc
  4003.     Example:
  4004.                 wdupc('X',5);       /* displays 'X' 5 times */
  4005.  
  4006.  
  4007.     Name:       werrmsg
  4008.     Purpose:    returns an error message from the last windowing function.
  4009.     Prototype:  char *werrmsg(void);
  4010.     Header:     cxlwin.h
  4011.     Inputs:     none
  4012.     Return:     the address of a static string containing an error message
  4013.                 corresponding to the error code from the last performed
  4014.                 windowing function.
  4015.     Also see:   wperror
  4016.     Example:
  4017.  
  4018.  
  4019.  
  4020.                                       56
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.                 wgotoxy(255,255);       /* invalid coordinates */
  4030.                 printf("Error message = %s\n",werrmsg());
  4031.  
  4032.  
  4033.     Name:       wfill
  4034.     Purpose:    fills in a region of active window with specified character
  4035.                 and attribute.
  4036.     Prototype:  int wfill(int wsrow,int wscol,int werow,int wecol,int ch,
  4037.                           int attr);
  4038.     Header:     cxlwin.h
  4039.     Inputs:     wsrow   - window start row
  4040.                 wscol   - window start column
  4041.                 werow   - window end row
  4042.                 wecol   - window end column
  4043.                 ch      - character to fill with
  4044.                 attr    - attribute
  4045.     Return:     W_NOERROR   - no error
  4046.                 W_NOACTIVE  - no active window
  4047.                 W_INVCOORD  - invalid coordinates
  4048.     Also see:   wbox
  4049.     Example:
  4050.                 wfill(2,2,10,20,'Z',LMAGENTA|_RED);
  4051.  
  4052.  
  4053.     Name:       wfindrec
  4054.     Purpose:    finds the address of the window record of the specified
  4055.                 window handle.
  4056.     Prototype:  struct _wrec_t *wfindrec(WINDOW whandle);
  4057.     Header:     cxlwin.h
  4058.     Inputs:     whandle     - window handle of window record to find
  4059.     Return:     the address of the found window record or NULL if no record
  4060.                 was found for specified handle.
  4061.     Example:
  4062.                 struct _wrec_t *wrecptr;
  4063.                 ....
  4064.                 wrecptr=wfindrec(3);
  4065.  
  4066.  
  4067.     Name:       wgetc
  4068.     Purpose:    gets a character from the keyboard within the active window,
  4069.                 echos character pressed to the screen in the attribute set
  4070.                 by the wtextattr() function.
  4071.     Prototype:  int wgetc(void);
  4072.     Header:     cxlwin.h
  4073.     Inputs:     none
  4074.     Return:     the ASCII value of the key pressed or a zero if an error
  4075.                 occurred. If error, the global variable _werrno will be set
  4076.                 to one of the following:
  4077.                     W_NOACTIVE  - no active window
  4078.     Also see:   wgetchf wscanf wtextattr
  4079.     Example:
  4080.                 int ch;
  4081.                 ......
  4082.                 ch=wgetc();
  4083.  
  4084.  
  4085.  
  4086.                                       57
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.     Name:       wgetchf
  4097.     Purpose:    gets a character from the keyboard within the active window,
  4098.                 allows only characters listed in the string of valid
  4099.                 characters.  Escape checking is provided by default.  This
  4100.                 can be turned off with the wsetesc() function.  Selected
  4101.                 character is echoed into the current window using the
  4102.                 attribute set by the wtextattr() function.
  4103.     Prototype:  int wgetchf(char *valid,int defchar);
  4104.     Header:     cxlwin.h
  4105.     Inputs:     valid   - address of the string containing the valid
  4106.                           characters
  4107.                 defchar - default selection in case Enter is pressed, or a
  4108.                           zero for no default
  4109.     Return:     the ASCII value of the key pressed or a zero if an error
  4110.                 occurred. If error, the global variable _werrno will be set
  4111.                 to one of the following:
  4112.                     W_NOACTIVE  - no active window
  4113.                     W_ESCPRESS  - Escape key was pressed
  4114.     Also see:   wgetc wscanf wtextattr
  4115.     Example:
  4116.                 int ch;
  4117.                 ......
  4118.                 ch=wgetchf("YyNn",'N');
  4119.                 if(_werrno==W_ESCPRESS) {
  4120.                     printf("Escape key was pressed\n");
  4121.                     exit(1);
  4122.                 }
  4123.  
  4124.  
  4125.     Name:       wgetns
  4126.     Purpose:    gets a string from the keyboard within active window, limits
  4127.                 the number of characters input to specified length.  Escape
  4128.                 checking is provided by default.  This can be turned off
  4129.                 with the wsetesc() function.  Entered characters will echo
  4130.                 to the active window in the attribute set by the wtextattr()
  4131.                 function.
  4132.     Prototype:  int wgetns(char *str,int maxlen);
  4133.     Header:     cxlwin.h
  4134.     Inputs:     str     - address of the allocated space to receive the
  4135.                           input string
  4136.                 maxlen  - the maximum length of the input string
  4137.     Return:     W_NOERROR   - no error
  4138.                 W_NOACTIVE  - no active window
  4139.                 W_ESCPRESS  - Escape key was pressed
  4140.     Also see:   wgets winputsf wscanf wsetesc wtextattr
  4141.     Example:
  4142.                 char fname[20];
  4143.                 ......
  4144.                 wputs("Enter your first name:  ");
  4145.                 wgetns(fname,5);
  4146.  
  4147.  
  4148.     Name:       wgets
  4149.  
  4150.  
  4151.  
  4152.                                       58
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.     Purpose:    gets a string from the keyboard within active window, echos
  4162.                 the characters to the screen in the attribute set by the
  4163.                 wtextattr() function.
  4164.     Prototype:  int wgets(char *str);
  4165.     Header:     cxlwin.h
  4166.     Inputs:     str     - the address of the allocated memory to receive the
  4167.                           input string
  4168.     Return:     W_NOERROR   - no error
  4169.                 W_NOACTIVE  - no active window
  4170.     Also see:   wgetns winputsf wscanf wtextattr
  4171.     Example:
  4172.                 char fname[20];
  4173.                 ......
  4174.                 wputs("Enter your first name:  ");
  4175.                 wgets(fname);
  4176.  
  4177.  
  4178.     Name:       wgotoxy
  4179.     Purpose:    sets cursor coordinates within the currently active window.
  4180.     Prototype:  int wgotoxy(int wrow,int wcol);
  4181.     Header:     cxlwin.h
  4182.     Inputs:     wrow    - window row (Y coordinate)
  4183.                 wcol    - window column (X coordinate)
  4184.     Return:     W_NOERROR   - no error
  4185.                 W_NOACTIVE  - no active window
  4186.                 W_INVCOORD  - invalid coordinates
  4187.     Also see:   wpgotoxy wreadcur
  4188.     Example:
  4189.                 wgotoxy(2,3);   /* set cursor to row 2, column 3 */
  4190.  
  4191.  
  4192.     Name:       whandle
  4193.     Purpose:    returns the handle of the active window
  4194.     Prototype:  WINDOW whandle(void);
  4195.     Header:     cxlwin.h
  4196.     Inputs:     none
  4197.     Return:     the handle of the active window or zero if error.  If error,
  4198.                 the global variable _werrno will be set to one of the
  4199.                 following:  W_NOACTIVE  - no active window
  4200.     Also see:   wactiv wisactiv
  4201.     Example:
  4202.                 printf("active handle = %d\n",whandle());
  4203.  
  4204.  
  4205.     Name:       whide
  4206.     Purpose:    hides the active window.  The next window becomes active.
  4207.     Prototype:  int whide(void);
  4208.     Header:     cxlwin.h
  4209.     Inputs:     none
  4210.     Return:     W_NOERROR   - no error
  4211.                 W_ALLOCERR  - memory allocation error
  4212.                 W_NOACTIVE  - no active window
  4213.     Also see:   wunhide
  4214.     Example:
  4215.  
  4216.  
  4217.  
  4218.                                       59
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.                 whide();
  4228.  
  4229.  
  4230.     Name:       whline
  4231.     Purpose:    draws a horizontal text line in active window using
  4232.                 characters defined by given box type.  If horizontal line
  4233.                 crosses a vertical line of the same box type, an appropriate
  4234.                 intersection or corner will be used.
  4235.     Prototype:  int whline(int wsrow,int wscol,int count,int btype);
  4236.     Header:     cxlwin.h
  4237.     Inputs:     wsrow   - window start row of line
  4238.                 wscol   - window start column of line
  4239.                 count   - number of line characters to display
  4240.                 btype   - box type (0-5)
  4241.     Return:     W_NOERROR   - no error
  4242.                 W_NOACTIVE  - no active window
  4243.                 W_INVCOORD  - text line too long for window
  4244.                 W_INVBTYPE  - invalid box type
  4245.     Also see:   wtextattr wvline
  4246.     Example:
  4247.                 whline(2,5,7,3);
  4248.  
  4249.  
  4250.     Name:       winpdef
  4251.     Purpose:    defines an area of the active window for keyboard input. See
  4252.                 the section "Multi-Field Formatted Input Functions" for the
  4253.                 complete details.
  4254.     Prototype:  int winpdef(int wrow,int wcol,char *str,char *format,
  4255.                             int fconv,int fattr,int update,
  4256.                             int (*validate) (char *));
  4257.     Header:     cxlwin.h
  4258.     Inputs:     wrow     - start of input, window's row coordinate
  4259.                 wcol     - start of input, window's column coordinate
  4260.                 str      - address of string buffer to receive input
  4261.                 format   - input field format string
  4262.                 fconv    - input field conversion character.  Applies
  4263.                            conversion to all letters in the input field. Can
  4264.                            be one of the following:
  4265.                                 0   - apply no conversion
  4266.                                 'L' - convert letters to lower case
  4267.                                 'M' - convert letters to mixed case
  4268.                                 'P' - password field (no echo)
  4269.                                 'U' - convert letters to upper case
  4270.                 fattr    - field attribute
  4271.                 update   - update pre-existing field?  0 = no, 1 = yes
  4272.                 validate - address of your user validation/modification
  4273.                            function.  The function must be declared like:
  4274.                                     int func(char *str);
  4275.                            Your user function will receive the field input
  4276.                            from the keyboard and will return zero if no
  4277.                            error.  If there was an error, then your function
  4278.                            will return the position of the error in the
  4279.                            string (starting at 1, not 0).  If you do not
  4280.                            wish to validate the field, then input NULL.
  4281.  
  4282.  
  4283.  
  4284.                                       60
  4285.  
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.     Return:     W_NOERROR   - no error
  4294.                 W_ALLOCERR  - memory allocation error
  4295.                 W_NOACTIVE  - no active window
  4296.                 W_INVCOORD  - invalid coordinates
  4297.                 W_INVFORMT  - invalid format string
  4298.                 W_LENFORMT  - length of format string is invalid
  4299.     Also see:   winpread winputsf wscanf
  4300.     Example:
  4301.                 char name[11];
  4302.                 ......
  4303.                 wputs("Enter name:");
  4304.                 winpdef(1,13,name,"MMMMMMMMMM",0,LCYAN|_BLUE,0,NULL);
  4305.  
  4306.  
  4307.     Name:       winpread
  4308.     Purpose:    processes keyboard input of all defined areas of active
  4309.                 window allowing editing back and forth between defined
  4310.                 fields.  See the section "Multi-Field Formatted Input
  4311.                 Functions" for the complete details.
  4312.     Prototype:  int winpread(void);
  4313.     Header:     cxlwin.h
  4314.     Inputs:     none
  4315.     Return:     W_NOERROR   - no error
  4316.                 W_NOACTIVE  - no active window
  4317.                 W_ESCPRESS  - Escape key was pressed
  4318.                 W_NOINPDEF  - no inputs defined
  4319.     Also see:   winpdef wsetesc wtextattr
  4320.     Example:
  4321.                 winpread();
  4322.  
  4323.  
  4324.     Name:       winputsf
  4325.     Purpose:    inputs a formatted string from the keyboard within a window.
  4326.                 Input characters will be echoed to the active window in the
  4327.                 attribute set by the wtextattr() function.
  4328.     Prototype:  int winputsf(char *str,char *fmt);
  4329.     Header:     cxlwin.h
  4330.     Inputs:     str     - address of the allocated space to receive string
  4331.                 fmt     - address of the format string, see section on using
  4332.                           format strings for a complete description.
  4333.     Return:     W_NOERROR   - no error
  4334.                 W_NOACTIVE  - no active window
  4335.                 W_ESCPRESS  - Escape key was pressed
  4336.                 W_INVFORMT  - invalid format string
  4337.     Also see:   wgetns wgets winpdef wscanf wsetesc wtextattr
  4338.     Example:
  4339.                 winputsf(str," !RE! 'Enter phone number:  (' ### "
  4340.                              " ') ' ### '-' #### ");
  4341.  
  4342.  
  4343.     Name:       winsline
  4344.     Purpose:    inserts a blank line in active window
  4345.     Prototoype: int winsline(int wrow,int direc);
  4346.     Header:     cxlwin.h
  4347.  
  4348.  
  4349.  
  4350.                                       61
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.     Inputs:     wrow    - window row to insert at
  4360.                 direc   - scroll direction:
  4361.                                 SUP    - scroll up
  4362.                                 SDOWN  - scroll down
  4363.     Return:     W_NOERROR   - no error
  4364.                 W_NOACTIVE  - no active window
  4365.                 W_INVCOORD  - invalid window row
  4366.     Also see:   wdelline wscroll
  4367.     Example:
  4368.                 winsline(3,SUP);
  4369.  
  4370.  
  4371.     Name:       wintodisk
  4372.     Purpose:    copies a screen window to a disk file.
  4373.     Prototype:  int wintodisk(int srow,int scol,int erow,int ecol,
  4374.                               char *fname);
  4375.     Header:     cxlwin.h
  4376.     Inputs:     srow    - starting row
  4377.                 scol    - starting column
  4378.                 erow    - ending row
  4379.                 ecol    - ending column
  4380.                 fname   - address of the string containing file to write to
  4381.     Return:     a zero if no error
  4382.     Also see:   disktowin scrntodisk wsave
  4383.     Example:
  4384.                 if(wintodisk(10,10,20,20,"WINDOW.DAT")) {
  4385.                     printf("Error creating file\n");
  4386.                     exit(1);
  4387.                 }
  4388.  
  4389.  
  4390.     Name:       wisactiv
  4391.     Purpose:    determines if specified window handle is active.
  4392.     Prototype:  int wisactiv(WINDOW whandle);
  4393.     Header:     cxlwin.h
  4394.     Inputs:     whandle - the handle of the window to check.
  4395.     Return:     a zero if handle is not active, a 1 if it is active.
  4396.     Also see:   wactiv wblocked whandle
  4397.     Example:
  4398.                 printf("handle 5 is %sactive\n",wisactiv(5)?"":"not ");
  4399.  
  4400.  
  4401.     Name:       wmenudef
  4402.     Purpose:    defines a window bar-selection menu option.  See the
  4403.                 "Bar-Selection Menu Functions" section for complete details.
  4404.     Prototype:  int wmenudef(int wrow,int wcol,int attr,char *str,
  4405.                              int tagchar,int tagattr,char *desc);
  4406.     Header:     cxlwin.h
  4407.     Inputs:     wrow    - window row to display option at
  4408.                 wcol    - window column to display option at
  4409.                 attr    - attribute to display option with
  4410.                 str     - address of the option string
  4411.                 tagchar - tag character to use for identification, may be
  4412.                           an ASCII value (0-255), lower case letters will
  4413.  
  4414.  
  4415.  
  4416.                                       62
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.                           automatically be converted to upper case.
  4426.                 tagattr - attribute of tag character
  4427.                 desc    - address of a string describing the menu option or
  4428.                           a NULL if no description is to be used.  If not
  4429.                           NULL, then the text description of the option will
  4430.                           appear on the next line down and will change with
  4431.                           each menu option, similar to the menus in many
  4432.                           popular spreadsheet packages.  The text
  4433.                           description will be displayed in the window's
  4434.                           current text attribute which can be set with the
  4435.                           wtextattr() function.  Thus, desc should be NULL
  4436.                           unless using horizontal menus.
  4437.     Return:     W_NOERROR   - no error
  4438.                 W_ALLOCERR  - memory allocation error
  4439.                 W_NOACTIVE  - no active window
  4440.     Also see:   wmenuget
  4441.     Example:
  4442.                 if(wmenudef(2,3,LCYAN|_BLUE,"Add record",'A',
  4443.                     WHITE|_BLUE,NULL)) {
  4444.                     printf("Error:  %s\n",werrmsg());
  4445.                     exit(1);
  4446.                 }
  4447.  
  4448.  
  4449.     Name:       wmenuget
  4450.     Purpose:    gets a window bar-selection menu selection from the
  4451.                 keyboard.  See the "Bar-Selection Menu Functions" section
  4452.                 for complete details.
  4453.     Prototype:  int wmenuget(int barattr,int taginit,int pulldown);
  4454.     Header:     cxlwin.h
  4455.     Inputs:     barattr   - the attribute to use for the selection bar
  4456.                 taginit   - tag character of initial selection bar position.
  4457.                             If an invalid tag character is specified, the
  4458.                             position defaults to the upper left.
  4459.                 pulldown  - this specifies how the defined bar-selection
  4460.                             menu will act.  It can be one of the following
  4461.                             values:
  4462.                                 0       - not part of a pull-down menu
  4463.                                           system
  4464.                                 PDMAIN  - main menu of a pull-down menu
  4465.                                           system
  4466.                                 PDPREV  - main menu, automatically select
  4467.                                           the previous pull-down menu
  4468.                                 PDNEXT  - main menu, automatically select
  4469.                                           the next pull-down menu
  4470.                                 PDMENU  - pull-down menu
  4471.     Return:     the tag character of the selected option or zero if an
  4472.                 error.  If error, the global variable _werrno will be set to
  4473.                 one of the following:
  4474.                             W_ESCPRESS  - Escape key was pressed
  4475.                 If PDMENU is specified for the pulldown parameter, then
  4476.                 wmenuget() will return PDPREV if LeftArrow is pressed,
  4477.                 PDNEXT if the RightArrow is pressed, or PDMENU if Esc is
  4478.                 pressed.
  4479.  
  4480.  
  4481.  
  4482.                                       63
  4483.  
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.     Also see:   wmenudef wsetesc wtextattr
  4492.     Example:
  4493.                 option=wmenuget(LCYAN|_GREEN,'A',0);
  4494.                 switch(option) {
  4495.                     case 'A':
  4496.                         ......
  4497.                     case 'D':
  4498.                         ......
  4499.                     case 0:
  4500.                         error_routine();
  4501.                     etc.
  4502.                 }
  4503.  
  4504.  
  4505.     Name:       wmessage
  4506.     Purpose:    displays text on the top or bottom border of active window
  4507.     Prototype:  int wmessage(char *str,int border,int leftofs,int attr);
  4508.     Header:     cxlwin.h
  4509.     Inputs:     str     - address of message string
  4510.                 border  - 0 = top border, 1 = bottom border
  4511.                 leftofs - offset from left border to display message at
  4512.                 attr    - attribute of message text
  4513.     Return:     W_NOERROR   - no error
  4514.                 W_NOACTIVE  - no active window
  4515.                 W_STRLONG   - string could not fit in window
  4516.                 W_NOBORDER  - window has no border
  4517.     Also see:   wtitle
  4518.     Example:
  4519.                 wmessage("Error!",0,3,LRED|BLINK);
  4520.  
  4521.  
  4522.     Name:       wmove
  4523.     Purpose:    moves the currently active window to a new location.
  4524.     Prototype:  int wmove(int nsrow,int nscol);
  4525.     Header:     cxlwin.h
  4526.     Inputs:     nsrow   - new starting row of window
  4527.                 nscol   - new starting column of window
  4528.     Return:     W_NOERROR   - no error
  4529.                 W_ALLOCERR  - memory allocation error
  4530.                 W_NOACTIVE  - no active window
  4531.     Also see:   wcopy wsize
  4532.     Example:
  4533.                 if(wmove(3,10)) {
  4534.                     printf("Error:  %s\n",werrmsg());
  4535.                     exit(1);
  4536.                 }
  4537.  
  4538.  
  4539.     Name:       wopen
  4540.     Purpose:    opens a screen window and makes it active, the cursor
  4541.                 location will be initialized to window row 0, column 0, and
  4542.                 the text attribute will be initialized to the same attribute
  4543.                 as the window.
  4544.     Prototype:  WINDOW wopen(int srow,int scol,int erow,int ecol,int btype,
  4545.  
  4546.  
  4547.  
  4548.                                       64
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.                           int battr,int wattr);
  4558.     Header:     cxlwin.h
  4559.     Inputs:     srow    - starting row
  4560.                 scol    - starting column
  4561.                 erow    - ending row
  4562.                 ecol    - ending column
  4563.                 btype   - border box type (0-5).  Use btype 5 for a
  4564.                           borderless window.
  4565.                 battr   - attribute of window's border.
  4566.                 wattr   - attribute of window (and initially the text)
  4567.     Return:     the window handle of the new window or a zero if an error
  4568.                 occurred. If error, the global variable _werrno will be set
  4569.                 to one of the following:
  4570.                     W_ALLOCERR  - memory allocation error
  4571.                     W_INVCOORD  - invalid coordinates
  4572.                     W_INVBTYPE  - invalid box type
  4573.     Also see:   videoinit wactiv wclose wcloseall
  4574.     Example:
  4575.                 if(!wopen(10,10,20,20,0,LCYAN|_BLUE,LCYAN|_BLUE)) {
  4576.                     printf("Error:  %s\n",werrmsg());
  4577.                     exit(1);
  4578.                 }
  4579.  
  4580.  
  4581.     Name:       wperror
  4582.     Purpose:    displays an error message window, waits for a keypress, then
  4583.                 returns to caller.
  4584.     Prototype:  int wperror(char *message);
  4585.     Header:     cxlwin.h
  4586.     Inputs:     message - address of the string containing the error message
  4587.     Return:     W_NOERROR   - no error
  4588.                 W_ALLOCERR  - memory allocation error
  4589.                 W_NOACTIVE  - no active window
  4590.                 W_STRLONG   - error message string too long
  4591.     Also see:   werrmsg
  4592.     Example:
  4593.                 wperror("Input must be numeric");
  4594.  
  4595.  
  4596.     Name:       wpgotoxy
  4597.     Purpose:    sets pseudo cursor coordinates within the currently active
  4598.                 window by wrapping around if coordinates are out of range.
  4599.     Prototype:  int wpgotoxy(int wrow,int wcol);
  4600.     Header:     cxlwin.h
  4601.     Inputs:     wrow    - window row (Y coordinate)
  4602.                 wcol    - window column (X coordinate)
  4603.     Return:     W_NOERROR   - no error
  4604.                 W_NOACTIVE  - no active window
  4605.                 W_INVCOORD  - invalid coordinates
  4606.     Also see:   wgotoxy wreadcur
  4607.     Example:
  4608.                 wpgotoxy(3,20);
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.                                       65
  4615.  
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.     Name:       wprintc
  4624.     Purpose:    displays a character in the currently active window.  Does
  4625.                 not update cursor position.  Does not recognize control
  4626.                 characters.
  4627.     Prototype:  int wprintc(int row,int col,int attr,int ch);
  4628.     Header:     cxlwin.h
  4629.     Inputs:     row     - cursor row (of the window)
  4630.                 col     - cursor column (of the window)
  4631.                 attr    - character attribute
  4632.                 ch      - character
  4633.     Return:     W_NOERROR   - no error
  4634.                 W_NOACTIVE  - no active window
  4635.                 W_INVCOORD  - invalid coordinates
  4636.     Also see:   wprints wputc
  4637.     Example:
  4638.                 wprintc(5,10,LMAGENTA|BLINK,"T");
  4639.  
  4640.  
  4641.     Name:       wprintf
  4642.     Purpose:    outputs a formatted string to active window at current
  4643.                 cursor position.  Works like the standard printf() function
  4644.                 does. Recognizes control characters.  Updates cursor
  4645.                 position. Characters will be displayed in the attribute set
  4646.                 by the wtextattr() function.
  4647.     Prototype:  int wprintf(const char *format,...);
  4648.     Header:     cxlwin.h
  4649.     Inputs:     format  - format string, refer to the section on printf() in
  4650.                           the run-time library reference.
  4651.                 ...     - any additional arguments
  4652.     Return:     W_NOERROR   - no error
  4653.                 W_NOACTIVE  - no active window
  4654.     Also see:   wputc wputns wputs wtextattr
  4655.     Example:
  4656.                 wprintf("%s %c %d\n",string_arg,char_arg,int_arg);
  4657.  
  4658.  
  4659.     Name:       wprints
  4660.     Purpose:    displays a string in the currently active window.  Does not
  4661.                 update cursor position.  Does not recognize control
  4662.                 characters.
  4663.     Prototype:  int wprints(int row,int col,int attr,char *str);
  4664.     Header:     cxlwin.h
  4665.     Inputs:     row     - cursor row (of the window)
  4666.                 col     - cursor column (of the window)
  4667.                 attr    - attribute
  4668.                 str     - address of string
  4669.     Return:     W_NOERROR   - no error
  4670.                 W_NOACTIVE  - no active window
  4671.                 W_INVCOORD  - invalid coordinates
  4672.                 W_STRLONG   - string too long for window
  4673.     Also see:   wcenters wputs wrjusts
  4674.     Example:
  4675.                 wprints(5,10,7,"Hello, world");
  4676.  
  4677.  
  4678.  
  4679.  
  4680.                                       66
  4681.  
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.     Name:       wputc
  4690.     Purpose:    displays a character in currently active window at current
  4691.                 cursor position.  Characters are displayed in the attribute
  4692.                 set by the wtextattr() function.  Recognizes control
  4693.                 characters.  Updates cursor position.
  4694.     Prototype:  int wputc(int ch);
  4695.     Header:     cxlwin.h
  4696.     Inputs:     ch  - the character to be printed
  4697.     Return:     W_NOERROR   - no error
  4698.                 W_NOACTIVE  - no active window
  4699.     Also see:   wdupc wprintc wprintf wtextattr
  4700.     Example:
  4701.                 wputc('X');
  4702.  
  4703.  
  4704.     Name:       wputns
  4705.     Purpose:    displays a string in the active window, formatting width of
  4706.                 output. Characters are displayed in the attribute set by the
  4707.                 wtextattr() function.  Recognizes control characters.
  4708.                 Updates cursor position.
  4709.     Prototype:  int wputns(char *str,int width);
  4710.     Header:     cxlwin.h
  4711.     Inputs:     str     - address of the string to print
  4712.                 width   - width to display output string with
  4713.     Return:     W_NOERROR   - no error
  4714.                 W_NOACTIVE  - no active window
  4715.     Also see:   wprintf wputs wtextattr
  4716.     Example:
  4717.                 wputns("Hello, world",5);
  4718.  
  4719.  
  4720.     Name:       wputs
  4721.     Purpose:    displays a string in currently active window at the current
  4722.                 cursor position.  Characters are displayed in the attribute
  4723.                 set by the wtextattr() function.  Recognizes control
  4724.                 characters.  Updates cursor position.
  4725.     Prototype:  int wputs(char *str);
  4726.     Header:     cxlwin.h
  4727.     Inputs:     str     - the address of the string to print
  4728.     Return:     W_NOERROR   - no error
  4729.                 W_NOACTIVE  - no active window
  4730.     Also see:   wprintf wprints wputns wtextattr
  4731.     Example:
  4732.                 wputs("\tHello, world\n\7");
  4733.  
  4734.  
  4735.     Name:       wrestore
  4736.     Purpose:    restores a previously saved window of screen memory.
  4737.     Prototype:  void wrestore(int *wbuf);
  4738.     Header:     cxlwin.h
  4739.     Inputs:     wbuf    - address of previously saved window
  4740.     Return:     none
  4741.     Also see:   srestore wsave
  4742.     Example:
  4743.  
  4744.  
  4745.  
  4746.                                       67
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.                 wrestore(wbuf);
  4756.  
  4757.  
  4758.     Name:       wrjusts
  4759.     Purpose:    displays a string right justified to specified column in
  4760.                 active window.
  4761.     Prototype:  int wrjusts(int wrow,int wjcol,int attr,char *str);
  4762.     Inputs:     wrow    - window row
  4763.                 wjcol   - window column to right justify to
  4764.                 attr    - attribute of string text
  4765.                 str     - address of string to display
  4766.     Return:     W_NOERROR   - no error
  4767.                 W_NOACTIVE  - no active window
  4768.                 W_INVCOORD  - invalid coordinates
  4769.                 W_STRLONG   - string too long to fit in window at specified
  4770.                               right justification column.
  4771.     Also see:   wcenters wprints
  4772.     Example:
  4773.                 wrjusts(3,20,LMAGENTA,"Hello, world");
  4774.  
  4775.  
  4776.     Name:       wsave
  4777.     Purpose:    saves a window of screen memory.
  4778.     Prototype:  int *wsave(int srow,int scol,int erow,int ecol);
  4779.     Header:     cxlwin.h
  4780.     Inputs:     srow    - starting row, upper left corner
  4781.                 scol    - starting column, upper left corner
  4782.                 erow    - ending row, lower right corner
  4783.                 ecol    - ending column, lower right corner
  4784.     Return:     address of newly created window buffer or NULL if a memory
  4785.                 allocation error occurred.
  4786.     Also see:   ssave videoinit wintodisk wrestore
  4787.     Example:
  4788.                 int *wbuf;
  4789.                 ......
  4790.                 wbuf=wsave(7,7,18,60);
  4791.                 if(wbuf==NULL) {
  4792.                     printf("Memory allocation error\n");
  4793.                     exit(1);
  4794.                 }
  4795.  
  4796.  
  4797.     Name:       wsbounds
  4798.     Purpose:    sets active window's scroll boundaries.
  4799.     Prototype:  int wsbounds(int wssrow,int wsscol,int wserow,int wsecol);
  4800.     Header:     cxlwin.h
  4801.     Inputs:     wssrow      - window scroll start row
  4802.                 wsscol      - window scroll start column
  4803.                 wserow      - window scroll end row
  4804.                 wsecol      - window scroll end column
  4805.     Return:     W_NOERROR   - no error
  4806.                 W_NOACTIVE  - no active window
  4807.                 W_INVCOORD  - invalid coordinates
  4808.     Also see:   wscroll
  4809.  
  4810.  
  4811.  
  4812.                                       68
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.     Example:
  4822.                 wsbounds(10,10,20,20);
  4823.  
  4824.  
  4825.     Name:       wscanf
  4826.     Purpose:    inputs a formatted string from keyboard, works like scanf()
  4827.                 does.  This function is only supported by Turbo C.
  4828.     Prototype:  int wscanf(const char *format,...);
  4829.     Header:     cxlwin.h
  4830.     Inputs:     format  - format string, refer to the section on scanf() in
  4831.                           Turbo C's run-time library reference.
  4832.                 ...     - any additional arguments
  4833.     Return:     W_NOERROR   - no error
  4834.                 W_NOACTIVE  - no active window
  4835.     Also see:   wgetc wgetns wgets winpdef winputsf wtextattr
  4836.     Example:
  4837.                 wscanf("%d %c",&int_value,&char_value);
  4838.  
  4839.  
  4840.     Name:       wscroll
  4841.     Purpose:    scrolls text within the active window, up or down.
  4842.     Prototype:  int wscroll(int count,int direc);
  4843.     Header:     cxlwin.h
  4844.     Inputs:     count       - number of lines to scroll
  4845.                 direc       - scroll direction:
  4846.                                     SUP    - scroll up
  4847.                                     SDOWN  - scroll down
  4848.     Return:     W_NOERROR   - no error
  4849.                 W_NOACTIVE  - no active window
  4850.     Also see:   wdelline winsline wsbounds
  4851.     Example:
  4852.                 wscroll(2,SDOWN);
  4853.  
  4854.  
  4855.     Name:       wsetesc
  4856.     Purpose:    sets the Escape checking for window keyboard input functions
  4857.                 that allow Escape checking.
  4858.     Prototype:  void wsetesc(int option);
  4859.     Header:     cxlwin.h
  4860.     Inputs:     option  - (0-1), 0 = turn Escape checking off, 1 = turn
  4861.                           Escape checking on
  4862.     Return:     none
  4863.     Also see:   wgetchf wgetns winpread winputsf wmenuget
  4864.     Example:
  4865.                 wsetesc(0);    /* turns Escape checking off  */
  4866.  
  4867.  
  4868.     Name:       wsize
  4869.     Purpose:    adjusts the size of the active window.
  4870.     Prototype:  int wsize(int nerow,int necol);
  4871.     Header:     cxlwin.h
  4872.     Inputs:     nerow   - new end row of sized window
  4873.                 necol   - new end column of sized window
  4874.     Return:     W_NOERROR   - no error
  4875.  
  4876.  
  4877.  
  4878.                                       69
  4879.  
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.                 W_ALLOCERR  - memory allocation error
  4888.                 W_NOACTIVE  - no active window
  4889.                 W_INVCOORD  - invalid coordinates
  4890.     Also see:   wcopy wmove
  4891.     Example:
  4892.                 if(wsize(23,40)) {
  4893.                     printf("Error:  %s\n",werrmsg());
  4894.                     exit(1);
  4895.                 }
  4896.  
  4897.  
  4898.     Name:       wsseldef
  4899.     Purpose:    defines a window string selection record.  For a complete
  4900.                 example of using these string selection functions, see the
  4901.                 section "String Selection Functions" in the Tutorial.
  4902.     Prototype:  int wsseldef(char *str);
  4903.     Header:     cxlwin.h
  4904.     Inputs:     str     - string to be used for selection
  4905.     Return:     W_NOERROR   - no error
  4906.                 W_ALLOCERR  - memory allocation error
  4907.                 W_NOACTIVE  - no active window
  4908.     Also see:   wsselget
  4909.     Example:
  4910.                 if(wsseldef("LPT1")) {
  4911.                     printf("%d %s\n",_werrno,werrmsg());
  4912.                     exit(1);
  4913.                 }
  4914.  
  4915.  
  4916.     Name:       wsselget
  4917.     Purpose:    gets a string selection from the keyboard
  4918.     Prototype:  char *wsselget(int attr);
  4919.     Inputs:     attr    - attribute of the selections
  4920.     Return:     the address of the selected string or NULL if error.  If
  4921.                 error, the global variable _werrno will be set to one of
  4922.                 the following:  W_NOERROR   - no error
  4923.                                 W_NOACTIVE  - no active window
  4924.                                 W_ESCPRESS  - Escape key was pressed
  4925.                                 W_NOSELDEF  - no selection records defined
  4926.     Also see:   wsetesc wsseldef
  4927.     Example:
  4928.                 char *p;
  4929.                 p=wsselget(LRED|_GREEN);
  4930.                 if(p==NULL) {
  4931.                     printf("%d %s\n",_werrno,werrmsg());
  4932.                     exit(1);
  4933.                 }
  4934.  
  4935.  
  4936.     Name:       wtextattr
  4937.     Purpose:    sets the default text attribute for text displayed in
  4938.                 active window.
  4939.     Prototype:  int wtextattr(int attr);
  4940.     Header:     cxlwin.h
  4941.  
  4942.  
  4943.  
  4944.                                       70
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.     Inputs:     attr    - the new text attribute
  4954.     Return:     W_NOERROR   - no error
  4955.                 W_NOACTIVE  - no active window
  4956.     Also see:   attrib wchgattr
  4957.     Example:
  4958.                 wtextattr(LMAGENTA|BLINK);
  4959.  
  4960.  
  4961.     Name:       wtitle
  4962.     Purpose:    gives active window a title and displays title on top border
  4963.                 line of window.
  4964.     Prototype:  int wtitle(char *str,int tpos,int tattr);
  4965.     Header:     cxlwin.h
  4966.     Inputs:     str     - address of title string or NULL to delete title
  4967.                 tpos    - position of title:
  4968.                             TDELETE - to delete title
  4969.                             TLEFT   - left justified
  4970.                             TCENTER - centered
  4971.                             TRIGHT  - right justified
  4972.                 tattr   - attribute of window's title
  4973.     Return:     W_NOERROR   - no error
  4974.                 W_NOACTIVE  - no active window
  4975.                 W_STRLONG   - title string too long for window
  4976.                 W_INVTPOS   - invalid title position argument
  4977.     Also see:   wmessage
  4978.     Example:
  4979.                 wtitle("[ My Window ]",TCENTER,YELLOW);
  4980.  
  4981.  
  4982.     Name:       wunhide
  4983.     Purpose:    unhides a previously hidden window.  The unhidden window
  4984.                 becomes the active window.
  4985.     Prototype:  int wunhide(WINDOW whandle);
  4986.     Header:     cxlwin.h
  4987.     Inputs:     whandle - the handle of the window to unhide
  4988.     Return:     W_NOERROR   - no error
  4989.                 W_ALLOCERR  - memory allocation error
  4990.                 W_NOTFOUND  - window handle not found
  4991.                 W_NOHIDDEN  - no hidden windows
  4992.                 W_NOTHIDD   - window not hidden
  4993.     Also see:   whide
  4994.     Example:
  4995.                 wunhide(w1);                /* unhides window w1 */
  4996.                 wunhide(_whrec->whandle);   /* unhides most recently
  4997.                                                hidden window         */
  4998.  
  4999.  
  5000.     Name:       wvline
  5001.     Purpose:    draws a vertical text line in active window using characters
  5002.                 defined by given box type.  If vertical line crosses a
  5003.                 horizontal line of the same box type, an appropriate
  5004.                 intersection or corner will be used.
  5005.     Prototype:  int wvline(int wsrow,int wscol,int count,int btype);
  5006.     Header:     cxlwin.h
  5007.  
  5008.  
  5009.  
  5010.                                       71
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.     Inputs:     wsrow   - window start row of line
  5020.                 wscol   - window start column of line
  5021.                 count   - number of line characters to display
  5022.                 btype   - box type (0-5)
  5023.     Return:     W_NOERROR   - no error
  5024.                 W_NOACTIVE  - no active window
  5025.                 W_INVCOORD  - entire text line could not fit in window
  5026.                 W_INVBTYPE  - invalid box type
  5027.     Also see:   whline wtextattr
  5028.     Example:
  5029.                 wvline(3,9,14,1);
  5030.  
  5031.  
  5032.  
  5033.  
  5034.  
  5035.  
  5036.  
  5037.  
  5038.  
  5039.  
  5040.  
  5041.  
  5042.  
  5043.  
  5044.  
  5045.  
  5046.  
  5047.  
  5048.  
  5049.  
  5050.  
  5051.  
  5052.  
  5053.  
  5054.  
  5055.  
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.                                       72
  5074.